World map ?
Hi,
If I was defining a world for my game, one such as were the user can walk around, the world just consists of objects such as cubes, pyramids, I was thinking would the following suffice:
[cube]
objId=1
[pyramid]
objId=2
Now some small classes (I''ve not listed the full functionality here for clarity sake) :
// simple vertex structure
typedef struct vertex
{
float x,y,z;
}_CustomVertex, _*pCustomVertex;
// World space offsets for object
class CWorldSpaceObject
{
public:
CWorldSpaceObject(int xPos, int yPos, int zPos)
{
m_Xpos = xPos;
m_yPos = yPos;
m_zPos = zPos;
}
int m_Xpos;
int m_Ypos;
int m_Zpos;
}
class CObject : public CWorldSpaceObject
{
private:
char* m_szObjName;
_CustomVertex m_objCoords;
public:
void setObjName(char* name);
void setObjXYZ(float x, float y, float z)
_*pCustomVertex getObjCoords() { return &m_objCoords; }
}
// Simple constructor for generic object
CObject::CObject(float xPos, float yPos, float zPos,
int wXPos, wYPos, wZPos) :
CWorldSpaceObject(wXPos, wYPos, wZPos),
m_objCoords.x(xPos), m_objCoord.y(yPos),
m_objCoords.z(zPos)
{
}
The above identifies the objects in the game and the object structure of one, now below shows what a map for the world would be....
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,2,0,2,0,0,0,0,0,0,0,0,0
0,0,0,0,1,0,0,0,0,C,0,0,1,0,0,0,0,0,0,0
1,0,0,0,0,1,0,0,0,0,0,0,0,0,2,0,0,1,0,0
The ''C'' in the map would be the camera - how would I display this world ? Given that each object in the world has a vertex structure and a given set of world x,y,z coordinates which can be seen from the class''s above how do I render them, what defines how big this world is ?
I hope someone knows what I''m on about here ? Any help is MUCH appreciated.
Kindest Regards,
sTeVe
PS - I know it possibly is to do with object space to world space, then world space to view space transformations, but I still don''t know how to define the size of the world and render parts of it ?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement