Archived

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

kimryo

Q3 BSP's face type....

Recommended Posts

When Face struct''s type=3,I codes following: m_Device.SetIndices(m_MeshIndexBuf);//MeshVerts,which stores the model vertices offsets,I collect is to an index buffer. m_Device.SetStreamSource(m_VertexBuf,sizeof(DXBSPVERTEX));//vertices lump,collect to a vertex buffer. //When face type==3(mesh) m_Device.DrawIndexedPrimitive(D3DPT_TRIANGLELIST,m_pFaces[faceIndex].numMeshVerts,m_pFaces[faceIndex].numMeshVerts/3,m_pFaces[faceIndex].meshVertIndex); D3D report error,Stream 0 does not have required number of vertices... The aftershock''s site is not available... We create world.

Share this post


Link to post
Share on other sites
But the doc said with MeshVerts index list,it should render with triangle list.

BTW:my face''s struct:

struct tBSPFace
{
int textureID; // The index into the texture array
int effect; // The index for the effects (or -1 = n/a)
int type; // 1=polygon, 2=patch, 3=mesh, 4=billboard
int vertexIndex; // The index into this face''s first vertex
int numOfVerts; // The number of vertices for this face
int meshVertIndex; // The index into the first meshvertex
int numMeshVerts; // The number of mesh vertices
int lightmapID; // The texture index for the lightmap
int lMapCorner[2]; // The face''s lightmap corner in the image
int lMapSize[2]; // The size of the lightmap section
float lMapPos[3]; // The 3D origin of lightmap.
float lMapVecs[2][3]; // The 3D space for s and t unit vectors.
float vNormal[3]; // The face normal.
int size[2]; // The bezier patch dimensions.
};


Thanks for reply.

We create world.

Share this post


Link to post
Share on other sites
kimryo , the BSP face structure declaration does not mention what you said and i still have the impression that it''s triangle fans .Also , you can render bezier patches with just the control points as fans . You will get a result but it''s not guaranteed to represent something/be smooth .

Share this post


Link to post
Share on other sites
The mesh verts describe a triangle list for both the type 1 and typ 3 faces.

Kimryo, I don''t do much D3D so I might be misreading your syntax, but I figure the problem is most likely that the meshverts are offsets from the vertex lumps.

Now it''s ben a while since I wrote my Q3 BSP viewer, but if I recall correctly, the first meshvert is actually given by vertexIndex + meshverts[meshVertIndex]



Share this post


Link to post
Share on other sites
quote:
Original post by CheeseGrater
The mesh verts describe a triangle list for both the type 1 and typ 3 faces.




Not 100% sure about mesh vertices but type1 (polygons) are triangle fans , not triangle lists.

Share this post


Link to post
Share on other sites
Yes,the polygons is triangle fan,and mesh is triangle list.

I do as this old post did,but without success:

www.gamedev.net\community\forums\topic.asp?topic_id=101751

The meshverts int-array is same as my m_MeshIndexBuf(index buffer),which store indices to index the vertices list.

tBSPFace::vertexIndex spec the base vertex index which index the first vertex in vertices list;And tBSPFace::meshVertIndex is to index the first index value in index buffer-m_MeshIndexBuf.(god damn index....)

So the finial call should be this:

DrawIndexedPrimitive(D3DPT_TRIANGLELIST,pCurrentFace->vertexIndex,0,pCurrentFace->numMeshVerts,pCurrentFace->meshVertIndex,pCurrentFace->numMeshVerts/3);

HRESULT DrawIndexedPrimitive(D3DPRIMITIVETYPE Type,
INT BaseVertexIndex,
UINT MinIndex,
UINT NumVertices,
UINT StartIndex,
UINT PrimitiveCount
);

What is wrong?

We create world.

Share this post


Link to post
Share on other sites
My m_Lumps[kMeshVerts].length/sizeof(int)==75852,and vertices count=38525....is that possible?Or something is wrong...

m_nNumMeshVertex=(m_Lumps[kMeshVerts].length/sizeof(int));//==75852
m_pMeshVerts=m_Heap.Alloc(m_nNumMeshVertex);//int * m_pMeshVerts;
fseek(pFile,m_Lumps[kMeshVerts].offset,SEEK_SET);
fread(m_pMeshVerts,sizeof(int),m_nNumMeshVertex,pFile);



We create world.

Share this post


Link to post
Share on other sites
quote:
Original post by Joe Forhens
Not 100% sure about mesh vertices but type1 (polygons) are triangle fans , not triangle lists.



The vertex list of the type 1 form a triangle fan. I think if you take a look you''ll find that the meshvert list is a triangle list.

Share this post


Link to post
Share on other sites