Alg. for a primative in the shape of a frame
Anyone know an algorithim that will use drawindexedprimitive() to create a frame shape? like:
----------------------
|.................... |
|..----------------|..|
|..| |..|
|..| |..|
|..| |..|
|..| |..|
|..| |..|
|..| |..|
|..| |..|
|.. --------------- ..|
|.....................|
-----------------------
where the dots are is where the triangles are.
We are here just like this,It really doesn't matter why.The world is here like it is,'We could laugh we could cry.Is it good or is it bad,Wright or maybe wrong?There's no use of being sad,Without a purpose within a song.
The graphic messed up of course, but i want it like either a picture frame, or how about just a long rectangle?
We are here just like this,It really doesn't matter why.The world is here like it is,'We could laugh we could cry.Is it good or is it bad,Wright or maybe wrong?There's no use of being sad,Without a purpose within a song.
An algorithm to draw frames on this board:
<PRE>
-Markus-
<PRE>
----------------------|.................... ||..----------------|..||..| |..| |..| |..||..| |..||..| |..||..| |..||..| |..||..| |..||.. --------------- ..||.....................|-----------------------
</PRE>-Markus-
Professional C++ and .NET developer trying to break into indie game development.
Follow my progress: http://blog.nuclex-games.com/ or Twitter - Topics: Ogre3D, Blender, game architecture tips & code snippets.
Follow my progress: http://blog.nuclex-games.com/ or Twitter - Topics: Ogre3D, Blender, game architecture tips & code snippets.
that''s just great now that that''s straight anyone know how to do it with Primitives ?????????????????????????
We are here just like this,It really doesn't matter why.The world is here like it is,'We could laugh we could cry.Is it good or is it bad,Wright or maybe wrong?There's no use of being sad,Without a purpose within a song.
I am not exactly sure what you want to do, I would have just taken a 3D model or a frame and resized it as desired.
Here''s some rather stupid code which I''ve just written. It draws a frame consisting of 8 triangles rendered in 4 calls to DrawPrimitive().
I wonder if that will be of use to you ?
-Markus-
Here''s some rather stupid code which I''ve just written. It draws a frame consisting of 8 triangles rendered in 4 calls to DrawPrimitive().
void DrawFrame(LPDIRECT3DDEVICE7 p_pD3DDevice, float p_fX1, float p_fY1, float p_fX2, float p_fY2, float p_fZ, float p_fThickness) { D3DLVERTEX l_CQuad[4]; float l_fU, l_fV; l_fU = p_fThickness / (p_fX2 - p_fX1); l_fV = p_fThickness / (p_fY2 - p_fY1); l_CQuad[0] = D3DLVERTEX(D3DVECTOR(p_fX1, p_fY1, p_fZ), WHITE, 0, 0.0f, 1.0f); l_CQuad[1] = D3DLVERTEX(D3DVECTOR(p_fX1, p_fY1 + p_fThickness, p_fZ), WHITE, 0, 0.0f, 1.0f - l_fV); l_CQuad[2] = D3DLVERTEX(D3DVECTOR(p_fX2, p_fY1 + p_fThickness, p_fZ), WHITE, 0, 1.0f, 1.0f - l_fV); l_CQuad[3] = D3DLVERTEX(D3DVECTOR(p_fX2, p_fY1, p_fZ), WHITE, 0, 1.0f, 1.0f); p_pD3DDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, D3DFVF_LVERTEX | D3DFVF_DIFFUSE, l_CQuad, 4, 0); l_CQuad[0] = D3DLVERTEX(D3DVECTOR(p_fX1, p_fY1 + p_fThickness, p_fZ), WHITE, 0, 0.0f, 1.0f - l_fV); l_CQuad[1] = D3DLVERTEX(D3DVECTOR(p_fX1, p_fY2 - p_fThickness, p_fZ), WHITE, 0, 0.0f, l_fV); l_CQuad[2] = D3DLVERTEX(D3DVECTOR(p_fX1 + p_fThickness, p_fY2 - p_fThickness, p_fZ), WHITE, 0, l_fU, l_fV); l_CQuad[3] = D3DLVERTEX(D3DVECTOR(p_fX1 + p_fThickness, p_fY1 + p_fThickness, p_fZ), WHITE, 0, l_fU, 1.0f - l_fV); p_pD3DDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, D3DFVF_LVERTEX | D3DFVF_DIFFUSE, l_CQuad, 4, 0); l_CQuad[0] = D3DLVERTEX(D3DVECTOR(p_fX2 - p_fThickness, p_fY1 + p_fThickness, p_fZ), WHITE, 0, 1.0f - l_fU, 1.0f - l_fV); l_CQuad[1] = D3DLVERTEX(D3DVECTOR(p_fX2 - p_fThickness, p_fY2 - p_fThickness, p_fZ), WHITE, 0, 1.0f - l_fU, l_fV); l_CQuad[2] = D3DLVERTEX(D3DVECTOR(p_fX2, p_fY2 - p_fThickness, p_fZ), WHITE, 0, 1.0f, l_fV); l_CQuad[3] = D3DLVERTEX(D3DVECTOR(p_fX2, p_fY1 + p_fThickness, p_fZ), WHITE, 0, 1.0f, 1.0f - l_fV); p_pD3DDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, D3DFVF_LVERTEX | D3DFVF_DIFFUSE, l_CQuad, 4, 0); l_CQuad[0] = D3DLVERTEX(D3DVECTOR(p_fX1, p_fY2 - p_fThickness, p_fZ), WHITE, 0, 0.0f, l_fV); l_CQuad[1] = D3DLVERTEX(D3DVECTOR(p_fX1, p_fY2, p_fZ), WHITE, 0, 0.0f, 0.0f); l_CQuad[2] = D3DLVERTEX(D3DVECTOR(p_fX2, p_fY2, p_fZ), WHITE, 0, 1.0f, 0.0f); l_CQuad[3] = D3DLVERTEX(D3DVECTOR(p_fX2, p_fY2 - p_fThickness, p_fZ), WHITE, 0, 1.0f, l_fV); p_pD3DDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, D3DFVF_LVERTEX | D3DFVF_DIFFUSE, l_CQuad, 4, 0); return; }
I wonder if that will be of use to you ?
-Markus-
Professional C++ and .NET developer trying to break into indie game development.
Follow my progress: http://blog.nuclex-games.com/ or Twitter - Topics: Ogre3D, Blender, game architecture tips & code snippets.
Follow my progress: http://blog.nuclex-games.com/ or Twitter - Topics: Ogre3D, Blender, game architecture tips & code snippets.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement