Results 1 to 7 of 7

Thread: 1 or 2 directX questions(should be easy)...

  1. #1

    Thread Starter
    Hyperactive Member VBD's Avatar
    Join Date
    Apr 2001
    Location
    The Place Above The Place Below Heavin
    Posts
    278

    1 or 2 directX questions(should be easy)...

    Hi, I am wondering how to do double culling in DirectX. Can anyone answer that for me? Also, how can I rotate an object(IE Polygon) without rotating the rest of the DirectX world(If I had 2 triangles and I wanted triangle A to rotate on its X axis and Triangle B to rotate on Its Y axis?). Thanx in advance...
    Hello

  2. #2
    Frenzied Member Zaei's Avatar
    Join Date
    Jul 2002
    Location
    My own little world...
    Posts
    1,710
    Double culling? Whazzat?

    You DO rotate the entire world when you use matrices. For the first triangle, set its rotation matrix, and render it. Set the matrix for the second triangle, and render it. The triangles are rendered With the current matrices, and change the matrices after you render has NO effect on what has been already rendered.

    Z.

  3. #3
    Lively Member
    Join Date
    Jul 2002
    Posts
    118
    Just confirming what Z said. Here are the steps.

    1) Reset Matrix
    2) Apply a rotation to the matrix
    3) Set the matrix transformation to the world view
    4) Render shape 1
    5) Reset Matrix
    6) Applay a rotation to the matrix
    7) Set the matrix transformation to the world view
    8) Render shape 2

    If u need function names they are something similar to this (I cant be bothered to look them up but these should be roughly right, I know they arent spot on though)

    Reset matrix = d3dxmatrixidentity MatrixName
    Apply Rotation = d3dxmatirxrotatey MatrixName (axis y rotation)
    Set transformation = d3ddevice.settransform SOMETHING_WORLD, MatrixName
    Render = DrawPrimitive bla bla bla

    Hope this helps

    Dan

  4. #4

    Thread Starter
    Hyperactive Member VBD's Avatar
    Join Date
    Apr 2001
    Location
    The Place Above The Place Below Heavin
    Posts
    278

    Talking Thanx!

    That helps fix my transformation junk. About double culling, what I mean is that if you rotate a triangle you can only see the front side. What if you want to see the front and back side?
    Hello

  5. #5
    Lively Member
    Join Date
    Jul 2002
    Posts
    118
    TO SEE BOTH SIDES USE THIS 1 LINE OF CODE

    D3DDEVICE.SETRENDERSTATE D3DRS_CULLMODE,1

    This following code is the actual function names I mentioned in my last post

    D3DXMatrixIdentity matWorld '//Reset our world matrix

    ' ROTATION

    D3DXMatrixIdentity matTemp
    D3DXMatrixRotationY matTemp, RotateAngle * (pi / 180)
    D3DXMatrixMultiply matWorld, matWorld, matTemp

    ' SCALING

    D3DXMatrixIdentity matTemp
    D3DXMatrixScaling matTemp, TileCurrScale, TileCurrScale, TileCurrScale
    D3DXMatrixMultiply matWorld, matWorld, matTemp

    ' TRANSLATION (MOVING)

    D3DXMatrixIdentity matTemp
    D3DXMatrixTranslation matTemp, TileCurrPos.X, TileCurrPos.Y, TileCurrPos.Z
    D3DXMatrixMultiply matWorld, matWorld, matTemp

    D3DDevice.SetTransform D3DTS_WORLD, matWorld

    Render '//Update the frame...

    That should sort u out

    Dan

    PS In this example he has applied 3 transformations at the same time and then rendered all geometry (shapes n stuff) to be rotated,scaled,etc.

  6. #6
    Frenzied Member Zaei's Avatar
    Join Date
    Jul 2002
    Location
    My own little world...
    Posts
    1,710
    Originally posted by danday1974
    D3DDEVICE.SETRENDERSTATE D3DRS_CULLMODE,1
    0.0!! Evil! NEVER use values like that =).

    Code:
    D3DDevice.SetRenderState D3DRS_CULLMODE, D3DCULL_NONE
    Z.

  7. #7
    Lively Member
    Join Date
    Jul 2002
    Posts
    118
    Z

    lol sorry i was thinking that myself but couldnt be assed to write another post which I have ended up doing anyway lol

    Dan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width