Changeset 1259
- Timestamp:
- Apr 21, 2012, 6:58:33 PM (11 years ago)
- Location:
- trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gpu/shader.cpp
r1241 r1259 393 393 if (uni.vert) 394 394 cgGLSetParameter4f((CGparameter)uni.vert, v.x, v.y, v.z, v.w); 395 #endif 396 } 397 398 void Shader::SetUniform(ShaderUniform const &uni, mat2 const &m) 399 { 400 #if defined USE_D3D9 || defined _XBOX 401 if (uni.flags & 1) 402 g_d3ddevice->SetPixelShaderConstantF((UINT)uni.frag, &m[0][0], 1); 403 if (uni.flags & 2) 404 g_d3ddevice->SetVertexShaderConstantF((UINT)uni.vert, &m[0][0], 1); 405 #elif !defined __CELLOS_LV2__ 406 glUniformMatrix2fv(uni.frag, 1, GL_FALSE, &m[0][0]); 407 #else 408 /* Not implemented */ 409 Abort(); 410 #endif 411 } 412 413 void Shader::SetUniform(ShaderUniform const &uni, mat3 const &m) 414 { 415 #if defined USE_D3D9 || defined _XBOX 416 /* FIXME: does this work at all? */ 417 if (uni.flags & 1) 418 g_d3ddevice->SetPixelShaderConstantF((UINT)uni.frag, &m[0][0], 3); 419 if (uni.flags & 2) 420 g_d3ddevice->SetVertexShaderConstantF((UINT)uni.vert, &m[0][0], 3); 421 #elif !defined __CELLOS_LV2__ 422 glUniformMatrix3fv(uni.frag, 1, GL_FALSE, &m[0][0]); 423 #else 424 /* FIXME: not implemented */ 425 Abort(); 395 426 #endif 396 427 } -
trunk/src/gpu/shader.h
r1241 r1259 67 67 void SetUniform(ShaderUniform const &uni, vec3 const &v); 68 68 void SetUniform(ShaderUniform const &uni, vec4 const &v); 69 void SetUniform(ShaderUniform const &uni, mat2 const &m); 70 void SetUniform(ShaderUniform const &uni, mat3 const &m); 69 71 void SetUniform(ShaderUniform const &uni, mat4 const &m); 70 72 -
trunk/src/lol/math/vector.h
r1258 r1259 1453 1453 } 1454 1454 1455 static Mat3<T> normal(Mat3<T> const &mat)1456 {1457 return transpose(inverse(mat));1458 }1459 1460 1455 void printf() const; 1461 1456 … … 1545 1540 { 1546 1541 return rotate(angle, v) * mat; 1547 }1548 1549 static Mat3<T> normal(Mat4<T> const &mat)1550 {1551 return transpose(inverse(Mat3<T>(mat)));1552 1542 } 1553 1543
Note: See TracChangeset
for help on using the changeset viewer.