-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathLight.h
49 lines (40 loc) · 1.16 KB
/
Light.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef __LIGHT__
#define __LIGHT__
#include"PreHeader.h"
//光照
struct Light
{
int type; //光照类型
XMFLOAT4 position; //光源位置
XMFLOAT4 direction; //光照方向
XMFLOAT4 ambient; //环境光强度
XMFLOAT4 diffuse; //漫反射光强度
XMFLOAT4 specular; //镜面光强度
float attenuation0; //常量衰减因子
float attenuation1; //一次衰减因子
float attenuation2; //二次衰减因子
float alpha; //聚光内锥角度
float beta; //聚光外锥角度
float falloff; //聚光衰减系数,一般为1.0f
};
struct Material
{
XMFLOAT4 ambient; //环境光反射率
XMFLOAT4 diffuse; //漫反射光反射率
XMFLOAT4 specular; //镜面反射光反射率
float power; //镜面反射系数
ID3D11ShaderResourceView *texture; //纹理视图
Material()
{
ambient.x = ambient.y = ambient.z = ambient.w = 0.5;
diffuse.x = diffuse.y = diffuse.z = diffuse.w = 0.5;
specular.x = specular.y = specular.z = specular.w = 0.5;
power = 0.5;
texture = NULL;
}
~Material()
{
texture = NULL;
}
};
#endif