Made it for personal use, but just wanted to share it . I haven't tested the get property functions yet - let me know if there are problems.
for the get functions - since I can't return an array -
use 0 to get x, use 1 to get y, 2 to get z...for example
float Light_X=GetLightPos(4,0); returns the X position of glLight4
float SpecCol = GetSpecCol(2, 1) returns the spec green value of glLight2
zip file includes the .dll and sample project.
You can add and position up to 8 lights, turn them off or on.
Also included some functions to set specular/diffuse/ambient properties to both materials and lights.
the mode property in the set mat functions :
0=front, 1=front and back,2=back
ZExternal Library Function Script:
/*
Code: Select all
/*
LightNum and ID refer to an integer that identifies a light.
The max number of LightSwitch is 8. This value should be between
0-7, but the function accepts any positive or negative integer.
Anything >7 = 7, <0 = 0.
Steps for creating a Light :
LightSwitch(1,1); This Enables GLlight1
SetLightPosition(1,0,20,10,0); This positions GLlight1 @ {x,y,z,w}={0,20,10,0}
SetDiffuseLight (1,1,0,0,1); This sets the GLlight1 RGBA color to red.
SetAmbientLight (1,.2,0,0,1); This seta a value that
brightens surface unaffected
by direct light. Should be kept
fairly low, but higher value can create
a pseudo self illumination effect.
SetSpecularLight (1,1,1,1,1) Sets the color of the HotSpot to white. This ony shows up
if you define specular value and shininess for the
material.
*/
//Turn a light off or on.
void LightSwitch(int LightNum,int Lswitch){}
//Set the position of the Light - note that W is usually 0
void SetLightPosition(int ID,float x,float y,float z,float w){}
//Set Light color properties
//It is importantant to set the light Diffuse color every time you create a light.
//Ambient and specular properties will not work if your material doesn't use these properties.
void SetDiffuseLight(int ID, float R,float G, float B, float A){}
void SetAmbientLight(int ID, float R,float G, float B, float A){}
void SetSpecularLight(int ID, float R,float G, float B, float A){}
//Use these to easily set Material Properties, set value prior to Use material in a Zexpression
void SetMatDiffuse(int mode, float R,float G, float B, float A){}
void SetMatAmbient(int mode, float R,float G, float B, float A){}
void SetMatSpecular(int mode, float R,float G, float B, float A){}
void SetMatShininess(int mode,float v){}
void SetMatEmission(int mode, float R,float G, float B, float A){}
//These are here as a way to get info about Lights in your scene.
float GetLightPos(int ID, int xywz){}
float GetDifCol(int ID, int colorID){}
float GetAmbCol(int ID, int colorID){}
float GetSpecCol(int ID, int colorID){}
float GetSpotDir(int ID, int xyw){}
float GetSpotCut(int ID){}
float GetSpotExp(int ID){}
//This can be very useful - returns 0 if light is off, 1 if light is on
int LightIsOn(int Id){}
/* Experimental = Added spotlight functions here try if you like
I was hopeing to be able to produce some attenuated lighting, but
I really don't know hot to calculate/set the right values here.
*/
void SetSpotDir(int ID, float x, float y, float z){}
void SetSpotCut(int ID, float angle){}
void SetSpotExp(int ID, float exponent){}
void SetQuadAtt(int ID, float v){}
void SetLinAtt(int ID, float v){}
void SetConstAtt(int ID, float v){}