Search code examples
c++visual-c++winapidirectx-9

directx rotation c++


Okay this is a hard question. I'm creating a cube and a pyramid in one vertex array. My problem is to rotate only pyramid vertex not the cube vertex but I don't know any function that can rotate some vertex. If I try to rotate the vertex I'll get pyramid and cube rotated.


Solution

  • Either

    • put the cube and the pyramid in different vertex arrays and use different transforms to render each array

    or

    • apply the rotations in a vertex shader, and pass in some auxiliary per-vertex info which lets the vertex shader decide whether each vertex should be treated as part of the cube or the pyramid (ie apply different transforms in each case). This'd be a bit like using a "blend weight" to do "vertex blending"; except you're only interested in the binary case.