灯光

西昌.何雨锋  

 

灯光

[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);

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值