• Advertisement


This topic is now archived and is closed to further replies.

milkshape with textures???

This topic is 5656 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I know nehe has a tut on it but it i dont like how it is in like 5 different files.... anyway.... im useing the source from the nehe game model loader.... here is the code
typedef struct MS3D_HEADER_TYP
   	char id[10];
	int  version;

typedef struct MS3D_VERTEX_TYP
	unsigned char flags;
	unsigned char refCount;
	char boneID;
	float vertex[3];

typedef struct MS3D_TRIANGLE_TYP
	unsigned short flags;
	unsigned short vertexIndices[3];
	float vertexNormals[3][3];
	float u[3];
	float v[3];
	unsigned char smoothingGroup;
	unsigned char groupIndex;

typedef struct MS3D_GROUP_TYP
   	unsigned char	flags;
   	char name[32];
   	unsigned short	numTriangles;
	unsigned short*	triangleIndices;
	char materialIndex;

class MS3D
		unsigned short	numVertices;
		MS3D_VERTEX*	vertices;
		unsigned short	numTriangles;
		MS3D_TRIANGLE*	triangles;
		unsigned short	numGroups;
		MS3D_GROUP*	groups;

	bool Load(char* filename);
	void Render(void);

	{	}

			delete vertices;		
			delete triangles;
			delete groups;

bool MS3D::
	Load(char* filename)
	FILE* file;
	MS3D_HEADER header;
	int loop;
    if((file= fopen(filename, "rb"))==NULL)
	   return false;
    fread(&header.id, sizeof(char), 10, file);
    fread(&header.version, 1, sizeof(int), file);
    fread(&numVertices, sizeof(unsigned short), 1, file);
    vertices= new MS3D_VERTEX [numVertices];
    for(loop=0; loopvertexIndices[loop3];

					glNormal3fv( tri->vertexNormals[loop3]);
					glTexCoord2f(tri->u[loop3], tri->v[loop3]);

can someone please help me get it to render the textures???? thanks a lot!

Share this post

Link to post
Share on other sites
u wanna use multiple textures? if so, u could bind textures before rendering the next group, but then u have to know what texture that group gets....
i''ve recently bought ms but i don''t know how to get the texture info either. i''m just binding the textures when i write the loader..

Share this post

Link to post
Share on other sites

  • Advertisement