comparison dmmodel.h @ 32:1215fdd0a8ab

Add support for specifying specular and shininess values per model.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 22 Nov 2019 22:57:14 +0200
parents 2403030a0352
children d640f2a34031
comparison
equal deleted inserted replaced
31:6847715b46cd 32:1215fdd0a8ab
119 return 0; 119 return 0;
120 } 120 }
121 }; 121 };
122 122
123 123
124 struct DMColor
125 {
126 int r, g, b, alpha;
127 };
128
129
130 struct DMVector3 124 struct DMVector3
131 { 125 {
132 float x, y, z; 126 float x, y, z;
133 }; 127 };
134 128
144 { 138 {
145 int nvertices, nfaces; 139 int nvertices, nfaces;
146 std::vector<DMVector3> vertices, normals; 140 std::vector<DMVector3> vertices, normals;
147 std::vector<unsigned int> faces; 141 std::vector<unsigned int> faces;
148 142
149 DMColor color; 143 DMVector4 ambient, diffuse, specular;
144 int shininess;
150 DMVector3 translate, scale, rotate; 145 DMVector3 translate, scale, rotate;
151 146
152 unsigned int id_prog, id_fs, id_vs; 147 unsigned int id_prog, id_fs, id_vs;
153 148
154 std::string 149 std::string
176 nfaces = nvertices = 0; 171 nfaces = nvertices = 0;
177 172
178 translate.x = translate.y = translate.z = 0; 173 translate.x = translate.y = translate.z = 0;
179 rotate.x = rotate.y = rotate.z = 0; 174 rotate.x = rotate.y = rotate.z = 0;
180 scale.x = scale.y = scale.z = 1; 175 scale.x = scale.y = scale.z = 1;
176
177 specular.p.x = specular.p.y = specular.p.z = 0.8f; specular.p.w = 1.0f;
178 shininess = 96;
181 } 179 }
182 }; 180 };
183 181
184 182
185 struct DMLight 183 struct DMLight