• FEATURED

View more

View more

View more

\$69

Image of the Day Submit

IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

Plane generation issue...

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

3 replies to this topic

#1Migi0027 (肉コーダ)  Members

Posted 03 July 2012 - 09:55 AM

Hi, im Miguel Petersen, and im currently having a problem with generating planes... I know that i did a stupid mistake, but unfortunately, i can't find it

So, i would like to ask you for some help:

#include <d3d11.h>
#include <d3dx11.h>
#include <d3dx10.h>
struct PLANE {FLOAT X, Y, Z; D3DXVECTOR3 Normal; FLOAT U, V;};
class PlaneStruct
{
public:PLANE PlaneVertices[3];
public:DWORD PlaneIndices[5];
void CreatePlane(float size)
{
PLANE PlaneObject;
PlaneObject.X = 1.0f * size;
PlaneObject.Y = 0.0f;
PlaneObject.Z = 1.0f * size;
PlaneObject.Normal = D3DXVECTOR3(0.0f, 0.0f, 1.0f);
PlaneObject.U = 0.0f;
PlaneObject.V = 0.0f;
PLANE PlaneObject1;
PlaneObject.X = -1.0f * size;
PlaneObject.Y = 0.0f;
PlaneObject.Z = 1.0f * size;
PlaneObject.Normal = D3DXVECTOR3(0.0f, 0.0f, 1.0f);
PlaneObject.U = 0.0f;
PlaneObject.V = 1.0f;
PLANE PlaneObject2;
PlaneObject.X = -1.0f * size;
PlaneObject.Y = 0.0f;
PlaneObject.Z = -1.0f * size;
PlaneObject.Normal = D3DXVECTOR3(0.0f, 0.0f, 1.0f);
PlaneObject.U = 1.0f;
PlaneObject.V = 0.0f;
PLANE PlaneObject3;
PlaneObject.X = 1.0f * size;
PlaneObject.Y = 0.0f;
PlaneObject.Z = -1.0f * size;
PlaneObject.Normal = D3DXVECTOR3(0.0f, 0.0f, 1.0f);
PlaneObject.U = 1.0f;
PlaneObject.V = 1.0f;

PlaneVertices[0] = PlaneObject;
PlaneVertices[1] = PlaneObject1;
PlaneVertices[2] = PlaneObject2;
PlaneVertices[3] = PlaneObject3;
PlaneIndices[0] = 0;
PlaneIndices[1] = 2;
PlaneIndices[2] = 1;
PlaneIndices[3] = 0;
PlaneIndices[4] = 3;
PlaneIndices[5] = 2;
}
};


Best Regards
Miguel Petersen

Edited by Migi0027, 03 July 2012 - 10:39 AM.

FastCall22: "I want to make the distinction that my laptop is a whore-box that connects to different network"

Blog about... stuff (GDNet, WordPress): www.gamedev.net/blog/1882-the-cuboid-zone/cuboidzone.wordpress.com/

#2Migi0027 (肉コーダ)  Members

Posted 03 July 2012 - 01:10 PM

If you want pictures:

FastCall22: "I want to make the distinction that my laptop is a whore-box that connects to different network"

Blog about... stuff (GDNet, WordPress): www.gamedev.net/blog/1882-the-cuboid-zone/cuboidzone.wordpress.com/

#3gnomgrol  Members

Posted 04 July 2012 - 06:03 AM

You are messing up pretty badly with the vertices/indices, a simple plane would simply look like this:
//4 vertices, 6 indices
[source lang="cpp"]vertices[0].pos = D3DXVECTOR3(0.0f, 0.0f, 0.0f);vertices[1].pos = D3DXVECTOR3(10.0f, 0.0f, 0.0f);vertices[2].pos = D3DXVECTOR3(0.0f, 0.0f, 10.0f);vertices[3].pos = D3DXVECTOR3(10.0f, 0.0f, 10.0f);vertices[0].normal = D3DXVECTOR3(0.0f, 1.0f, 0.0f);vertices[1].normal = D3DXVECTOR3(0.0f, 1.0f, 0.0f);vertices[2].normal = D3DXVECTOR3(0.0f, 1.0f, 0.0f);vertices[3].normal = D3DXVECTOR3(0.0f, 1.0f, 0.0f);vertices[0].tex = D3DXVECTOR2(0.0f, 1.0f); // texcoords start left top corner!vertices[1].tex = D3DXVECTOR2(1.0f, 1.0f);vertices[2].tex = D3DXVECTOR2(0.0f, 0.0f);vertices[3].tex = D3DXVECTOR2(1.0f, 0.0f);indices[0] = 0;indices[1] = 1;indices[2] = 2;indices[3] = 0;indices[4] = 2;indices[5] = 3;[/source]

I hope that helps

Edited by gnomgrol, 04 July 2012 - 06:24 AM.

#4Migi0027 (肉コーダ)  Members

Posted 04 July 2012 - 07:14 AM

Thanks for replying, ill test if it works when i get another challange done:
http://www.gamedev.net/topic/627421-c-dx11-render-to-panel/

FastCall22: "I want to make the distinction that my laptop is a whore-box that connects to different network"

Blog about... stuff (GDNet, WordPress): www.gamedev.net/blog/1882-the-cuboid-zone/cuboidzone.wordpress.com/

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.