Updated. Rewritten major portions of the code!
Also provided functions very similar to the lighting system in eXtends =)
Feel free to parse and cannabilize for your own needs
HOW TO USE~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In order for an object to use this system, you must make a managed object 'profile' to go with it.
This will store all information necessary for this zoning system to work.
For this example, "n" means an object number.
Create a profile for the managed object. you must do this or the other functions will silently fail
------> Create_Managed_Object(n)
Once this is done, we can add other features to it simply by calling the approperiate functions.
These are all ala-carte; an object can use any combination of them. Just run the update methods per frame and the rest is
done for you. nHow you decide to divy zones is up to you, just pass in a value and you're good to go.
Pass in a -1 to allow an object to always be 'on'
------> Create_Managed_Rendering_Object(n, pZoneID)
This allows you to disable and enable rendering of the object based on what 'zone' the player is in.
-----> Create_Managed_Collision_Object(n, pZoneID, pPriority, pCollisionType, pCollisionFlag, pRadiusX#, pRadiusY#, pRadiusZ#, pOffsetX#, pOffsetY#, pOffsetZ#)
This allows you to disable and enable collision detection of an object based on zones as well.
You have to provide code that will work with your collision system, but there are templates that are called that you just need to fill in.
Higher priority objects will get activated before lower priority ones
-----> Set_Object_Hardware_Lighting(n, pLightValue)
Sets whether or not an object will receive hardware lighting. Independent from managed lighting,
this just sets whether or not an object uses hardware lights.
-----> Create_Managed_Lighting_Object(n, pZoneID, pPriority)
Allows you to pass in an object that will dynamically alter the hardware lights
to prevent lights from bleeding into the walls. Higher priorities outweigh lower ones
-----> Create_Managed_Shadowing_Object(n, pZoneID, pShadowMeshID, pShadowRange, pUseShader)
Allows you to manage whether or not an object will cast shadows within a zone =)
ShadowMeshId is for whether or not you will ue a replacement mesh for the shadow
Range is for the distance the shadow will go until it cuts off
useShader is whether or not to use GPU or CPU shading. 1=gpu, 0=cpu. use 1 unless the model contains bones, then use 0
-----> Create_Animated_Texture(n, pTexOri, pTexMin, pTexMax, pFPS)
Allows you to make an animated texture for a mesh. Doesn't rely on zones =P
-----> Init_Virtual_Lights()
-----> Create_Virtual_Light(pPosX#, pPosY#, pPosZ#, pColorR#, pColorG#, pColorB#, pStyle, pRange)
-----> Update_Virtual_Lights(pCameraX#, pCameraY#, pCameraZ#)
Allows you to create as many lights as you want.
The closest 7 lights to the camera will be activated within the scene.
In addition, managed lighting objects will effect the visibility and range of these lights to prevent bleedthrough with solid objects