Q3 BSP's face type....

Started by
9 comments, last by kimryo 20 years, 12 months ago
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.
God create the world,we create another one.-Reference
Advertisement
If i''m not mistaken , Meshes are triangle Fans too . Did you convert the data accordingly so that you can render it using indexed triangle lists ?
Thank you all :)
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.
God create the world,we create another one.-Reference
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 .
Thank you all :)
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]



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.

Thank you all :)
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.
God create the world,we create another one.-Reference
From the error message that D3D reports to you , it means that the Vertex Buffer assigned to stream 0 does not have the required number of vertices you want to render .
Thank you all :)
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.
God create the world,we create another one.-Reference
Nervermind,I fix it.


Thanks Joe Forhens and CheeseGrater.

We create world.
God create the world,we create another one.-Reference

This topic is closed to new replies.

Advertisement