Kaedroho Object Level of Detail Plugin for Dark Basic Professional Version 1.01
===============================================================================

This DLL allows you to add LOD levels to your objects in your games!
LOD is controlling the detail of objects depending on their distance.
The number of LOD levels and objects are unlimited!




Performance:
Very optimised code. However, optimisation will be improved in future updates.
1200 Objects with 5 LOD levels runs at about 80 FPS on a 2.8 GHz processor.


RAM usage:
Global RAM usage: 300 bytes
RAM Per Object: 18 bytes
RAM Per LOD Level: 19 bytes




Installation:

Put the .ini file in the Editor/Keywords folder
Put the .dll file in the Compiler/plugins-user folder
Restart DBPro




Changelog;

-1.01
Added commands:
KD ReleaseLODCamera
KD DisableObjectLOD
KD EnableObjectLOD
KD ReleaseObject

Optimised update function
Fixed copy camera bug



Commands:


KD SetupLODObject(Object ID,LODLevel Count)

Registers an object with the system. This object is used for transforming the other LOD levels, as well as itsself.

Low complexity - Could be called in main loop without much impact on FPS. Not reccomended for many calls per loop.

Object ID is the ID of the parent object (highest LOD level). This object must already exist.

LOD level count is the amount of LOD levels to be made, this ranges from 0 to infinity.

Returns an object Handle to be used with other commands





KD Setup Object LOD Level(Object Handle,LODLevelID,ChildObjectID)

Sets the object ID of a LOD Level. The child object must exist. When called, the child object ID can be forgotten as the plugin will automatically position and rotate it.

Low complexity - Could be called in main loop without much impact on FPS. Not reccomended for many calls per loop.

Object handle must be a number returned from previous call to "KD SetupLODObject".

LODLevel ID is the ID of the LOD Level

Child object is the object ID which will be displayed at this LOD level.





KD SetLODLevelDistances(Object Handle,LODLevelID,Near Distance, Far Distance)

Sets the draw distances of a LOD level.

Super low complexity. Can be called thousands of times in main loop without much impact to FPS.

Object handle must be a number returned from previous call to "KD SetupLODObject".

LODLevel ID is the ID of the LOD Level

Near and far distances are the min and max distances from the camera to draw the object





KD Register LOD Camera(CameraID,Copyfrom camera)

Tells the system that it should update for this camera. This is not automatically called for camera 0.

Very Low complexity - can be called many times in the main loop with out much FPS impact.

Camera ID is the DBPro ID of the camera

copy from camera is the camera which it should copy LOD data from.
Use this if the camera is in the exact same position as another camera. Otherwise, set this to -1.
If used, the copyfrom camera must be registered with the system.



KD UpdateLOD()

Updates LOD for all cameras

Low complexity - Can be called multiple times per loop. Although that would be pointless as you only need to call it once.

No parameters or returns



KD ReleaseLODCamera(CameraID)

Deletes a LOD camera. And stops the system using it.

This function does not delete the DBPro camera.

Low complexity

The camera ID is the DBPro Camera ID which was parsed to "Register LOD Camera"



KD DisableObjectLOD(ObjectHandle)

Stops the system from calculating LOD levels until "KD EnableObjectLOD" is called for this object.
Use this with objects which are off screen.

Super low complexity - only sets an internal boolean value, thats it.

Objecthandle is the Handle of the object returned in "KD SetupLODObject"



KD EnableObjectLOD(ObjectHandle)

Makes the system start calculating LOD levels for this object again. Reverses "KD DisableObjectLOD" function.

Super low complexity - only sets an internal boolean value, thats it.

Objecthandle is the Handle of the object returned in "KD SetupLODObject"



KD ReleaseObject(ObjectHandle)

Deletes an object

Low complexity.

Objecthandle is the Handle of the object returned in "KD SetupLODObject"