Help Support the Baja Engine! Donate to Breezeway Studios!
engine

Search:

Purpose


The engine library contains configuration settings for the engine.

time [Number]


Time is a number that varies inversely with the frame rate. You need to multiply all velocities dealing with animation by this factor! This will ensure that someone who is running your application at 60 fps and 30fps will see everything run at the same speed.

Note: there is a mirror of this value in the GLOBAL table that is shorter to type. Use that one instead.

Code


function perframe()

if correct than
--correct, door will rotate at the same speed on all computers
obj.door.rot.y=obj.door.rot.y+2*time
else
--incorrect! door will run at different speeds on different computers
obj.door.rot.y=obj.door.rot.y+2
end

end



frame [Number]


The current frame that the engine is working on. Increases by one each time a frame is compleated.

fps [Number]


The current frames per second.

limitFps [Number]


If this is set to 0, then fps are not limited. If it is >0, then fps will never go higher than this number.

frameTime [Number]


The amount of time it's taking to render a frame, in miliseconds.

pause() [Function]


Pauses rendering. Useful to, for example, stop the engine from consuming all your cpu cycles so that you can switch to some other program to fix something and then resume. Note: when the script console is open, ctrl-p causes this function to get called.

pauseFps [Number]


This is the fps that the engine runs at when it is paused.

resume() [Function]


Resumes rendering. Note: when the script console is open, ctrl-r causes this function to get called.

edition [String]


Returns the edition of the engine. Either "professional","viewer","indie", or "trial".

version [String]


Returns the version number of the engine.

developer [Boolean]


True if the engine is a developer edition, false otherwise.

title [String]


This is the title of the window of the application. The default title is "3d Application." Note: to set this, it must be set before the window is initialized. This means that it must be set outside of a function.

Code

function main()
        --blah
end

function perframe()
        -blah
end

--set the title outside the functions
engine.title='My App'


logDroppedFrames [Boolean]


If this is true, the engine writes "DROPPEDFRAME" to the console whenever a frame has taken longer than a second to render. By default it is true. It is sometimes useful for debugging.

sceneGraph [Boolean]


enable/disable the scene graph (makes children inherit properties from their parents). On by default.

displacement [Boolean]


true if displacement effects are enabled, false if disabled. Note: not all editions support displacement.

water [String]


The quality of the water effect. Valid strings are "best","bad", and "none". Note: not all editions support all modes.

reflect [String]


The quality of the reflection effect. Valid strings are "best and "none". Note: not all editions support all modes.

environmentMaps [Boolean]


true if cubic environment maps are enabled, false if disabled. Note: not all editions support cubic environment maps.

wireframe [Boolean]


If true, the renderer will render everything wireframe-style instead of shaded.

drawImplicit [Boolean]


This will enable drawing of implicit objects, like nulls + ik chains.

drawbb [Boolean]


If true, the renderer will draw yellow bounding boxes around all objects. Useful for debugging.

normals [Boolean]


If true, the renderer will draw the Normals (blue), Binormals (red) and Tangents (green) of all the objects. Useful for debugging.

normalsSolo [String]


If this string is empty, than the normals of all objects are drawn. If it is the name of an object, than only the normals of that object will be drawn.

textureLevel [Number]


This determines the detail that textures are drawn at. If it is 0, then textures are drawn at full size (ie 512x512). If it is 1, then they are a quarter size (256x256), 2 at eighth (128x128), etc. This is useful because on older cards your textures may cause the card to run out of texture memory and the fps to plummet. You should but a this as an option somewhere in your menus.

widescreen [Table]


see EngineWidescreen

window [Table]


see EngineWindow

glow [Table]


see EngineGlow

blur [Table]


see EngineBlur

framebufferEffect [Table]


see EngineFramebufferEffect

renderer [Table]


see EngineRenderer

sun [Table]


see EngineSun

picker [Table]


see EnginePicker

------

leakDump() [Function]


depreciated - does nothing.

sync() [Function]


depreciated - does nothing.

enableSync() [Function]


depreciated - does nothing.

disableSync() [Function]


depreciated - does nothing.

syncTo() [Function]


depreciated - does nothing.

minimumHardwareDebug [Boolean]


If true, the engine acts like only the bare minimum hardware is available, in order to preview how the application will run on old systems. This can be combined with limitFps to simulate slower, old graphics cards.

Node: For best results, you should still test your game on actual old hardware, if possible.

Note: This should be places outside of any function in your script, so that it is set at engine start.

Code

function main()

end

engine.minimumHardwareDebug=true


saveFramebuffer(file [String])


Saves the frame that is currently being drawn. Only one file will be saved per frame, so if multiple calls to this function are made in one frame only the last will actually be saved. Very slow.

optimize [String]


Changes the way the engine draws objects. "modern", "list", or "none". Should be left as the default in almost every case.