西昌.何雨锋
[attenuation 稀薄,衰减] [specularlevel 反射等级]
建立一个灯光: light1=new CTVLightEngine();
light1->CreateDirectionalLight(&Vector3(-1, -1, 0), 1, 1, 1, "simple directional light", 0);
//这里的灯光必须从下向上照,才能正常的渲染,否则出来的是反的。
int CreateDirectionalLight(cTV_3DVECTOR* direction, float red, float green, float blue,const char* name = NULL, float specularlevel = 0.3f );
//建立一个直射灯光(位置,R,g,b,"名称",反射等级)
//当反射等级越高,则物体间反射的光线越真实,但渲染速度也越低。
int CreateLight(cTV_LIGHT* light, const char* lightName = NULL);
int CreatePointLight(cTV_3DVECTOR* point, float red, float green, float blue, float radius, const char* name = NULL, float specularlevel = 0.3f);
//建立一个点光源
int CreateSpotLight(cTV_3DVECTOR* position, cTV_3DVECTOR* direction, float red, float green, float blue, float radius, float phi, float theta,const char* name = NULL, float specularlevel = 0.3f);
//建立一个桶灯
void SetLightPosition(int iLight, float x, float y, float z);
//放置灯光位置
void SetLightAttenuation(int iLight, float attenuation0, float attenuation1, float attenuation2);
//设置灯光衰减
void SetLightColor(int iLight, float red, float green, float blue);
//设置灯光颜色
void SetLightSpecularColor(int iLight, float red, float green, float blue);
//设置灯光specular颜色
void SetLightAmbientColor(int iLight, float red, float green, float blue);
//设置灯光Ambient颜色
void SetLightDiffuseColor(int iLight, float red, float green, float blue);
//设置灯光diffuse颜色
void SetLightRange(int iLight, float radius);
//设置灯光范围
void SetLightDirection(int iLight, float x, float y, float z);
//设置灯光照向位置
void SetLight(int iLight, cTV_LIGHT* newLight);
//复制一灯为一新灯
void GetLight(int iLight, cTV_LIGHT* retLightInfo);
void SetLightProperties(int iLight, bool bManagedLight, bool bCastShadows, bool bUseForLightmapping);
//设置灯光属性(灯光Id,是否管理灯光,是否有影子,是否使用光图)
// new
void SetBumpLightProperties(int iLight, bool bSpecular, bool bApproximatePointLightByDirLight);
//设置bump灯光属性(灯光ID,是否允许镜面反射,是否允许线光为近似点光)
// end new
void EnableLight(int iLight, bool bEnable);
bool IsLightEnabled(int iLight);
int GetLightFromName(const char* lightName);
int DeleteAllLights();
int DeleteLight(int iLight);
void SetSpecularLighting(bool bEnable = false);
void SetLightCubeMap(int iLightID, int iCubeTextureMap);
//设置光线剪切图(光线ID,剪切图)
void SetGlobalAmbient(float fRed, float fGreen, float fBlue);
int GetCount();
int GetActiveCount();
char* GetLightName(int iLight);
void SetLightSpotAngles(int iLight, float fPhi, float fTheta);
//设置桶灯的角度
void SetLightType(int iLight, cCONST_TV_LIGHTTYPE eType);
//设置灯光类型
bool IsLightActive(int iLightID);
void SetLightSpotFalloff(int iLight, float fFalloff);
void GetLightProperties(int iLight, bool* retbManagedLight, bool* retbCastShadows, bool* retbUseForLightmapping);
void GetBumpLightProperties(int iLight, bool* retbSpecular, bool* retbApproximatePointLightByDirLight);
void SetProjectiveShadowsProperties(int iLight, cCONST_TV_LIGHTSHADOW eShadow, int iMapSize = 512);