|
28 | 28 | #include "WW3D2/lightenvironment.h" |
29 | 29 | #include "WWDebug/wwdebug.h" |
30 | 30 |
|
| 31 | +static unsigned short To_Unsigned_Short(unsigned int value) |
| 32 | +{ |
| 33 | + const unsigned short narrowed = static_cast<unsigned short>(value); |
| 34 | + WWASSERT(narrowed == value); |
| 35 | + return narrowed; |
| 36 | +} |
| 37 | + |
31 | 38 | static D3DTRANSFORMSTATETYPE To_D3D_Transform(RenderBackendTransform transform) |
32 | 39 | { |
33 | 40 | switch (transform) |
@@ -224,37 +231,40 @@ void Renderer::Set_Vertex_Buffer(const DynamicVBAccessClass & vba) |
224 | 231 | DX8Wrapper::Set_Vertex_Buffer(vba); |
225 | 232 | } |
226 | 233 |
|
227 | | -void Renderer::Set_Index_Buffer(const IndexBufferClass * ib, unsigned short index_base_offset) |
| 234 | +void Renderer::Set_Index_Buffer(const IndexBufferClass * ib, unsigned int index_base_offset) |
228 | 235 | { |
229 | | - DX8Wrapper::Set_Index_Buffer(ib, index_base_offset); |
| 236 | + DX8Wrapper::Set_Index_Buffer(ib, To_Unsigned_Short(index_base_offset)); |
230 | 237 | } |
231 | 238 |
|
232 | | -void Renderer::Set_Index_Buffer(const DynamicIBAccessClass & iba, unsigned short index_base_offset) |
| 239 | +void Renderer::Set_Index_Buffer(const DynamicIBAccessClass & iba, unsigned int index_base_offset) |
233 | 240 | { |
234 | | - DX8Wrapper::Set_Index_Buffer(iba, index_base_offset); |
| 241 | + DX8Wrapper::Set_Index_Buffer(iba, To_Unsigned_Short(index_base_offset)); |
235 | 242 | } |
236 | 243 |
|
237 | 244 | void Renderer::Set_Index_Buffer_Index_Offset(unsigned offset) |
238 | 245 | { |
239 | 246 | DX8Wrapper::Set_Index_Buffer_Index_Offset(offset); |
240 | 247 | } |
241 | 248 |
|
242 | | -void Renderer::Draw_Triangles(unsigned buffer_type, unsigned short start_index, unsigned short polygon_count, |
243 | | - unsigned short min_vertex_index, unsigned short vertex_count) |
| 249 | +void Renderer::Draw_Triangles(unsigned buffer_type, unsigned int start_index, unsigned int polygon_count, |
| 250 | + unsigned int min_vertex_index, unsigned int vertex_count) |
244 | 251 | { |
245 | | - DX8Wrapper::Draw_Triangles(buffer_type, start_index, polygon_count, min_vertex_index, vertex_count); |
| 252 | + DX8Wrapper::Draw_Triangles(buffer_type, To_Unsigned_Short(start_index), To_Unsigned_Short(polygon_count), |
| 253 | + To_Unsigned_Short(min_vertex_index), To_Unsigned_Short(vertex_count)); |
246 | 254 | } |
247 | 255 |
|
248 | | -void Renderer::Draw_Triangles(unsigned short start_index, unsigned short polygon_count, |
249 | | - unsigned short min_vertex_index, unsigned short vertex_count) |
| 256 | +void Renderer::Draw_Triangles(unsigned int start_index, unsigned int polygon_count, |
| 257 | + unsigned int min_vertex_index, unsigned int vertex_count) |
250 | 258 | { |
251 | | - DX8Wrapper::Draw_Triangles(start_index, polygon_count, min_vertex_index, vertex_count); |
| 259 | + DX8Wrapper::Draw_Triangles(To_Unsigned_Short(start_index), To_Unsigned_Short(polygon_count), |
| 260 | + To_Unsigned_Short(min_vertex_index), To_Unsigned_Short(vertex_count)); |
252 | 261 | } |
253 | 262 |
|
254 | | -void Renderer::Draw_Strip(unsigned short start_index, unsigned short polygon_count, |
255 | | - unsigned short min_vertex_index, unsigned short vertex_count) |
| 263 | +void Renderer::Draw_Strip(unsigned int start_index, unsigned int polygon_count, |
| 264 | + unsigned int min_vertex_index, unsigned int vertex_count) |
256 | 265 | { |
257 | | - DX8Wrapper::Draw_Strip(start_index, polygon_count, min_vertex_index, vertex_count); |
| 266 | + DX8Wrapper::Draw_Strip(To_Unsigned_Short(start_index), To_Unsigned_Short(polygon_count), |
| 267 | + To_Unsigned_Short(min_vertex_index), To_Unsigned_Short(vertex_count)); |
258 | 268 | } |
259 | 269 |
|
260 | 270 | void Renderer::Set_Transform(RenderBackendTransform transform, const Matrix4x4 & m) |
|
0 commit comments