Note that there are some explanatory texts on larger screens.

plurals
  1. POVW3D Model Format
    primarykey
    data
    text
    <p>Lately, I have been working to resurrect an old open source game. My main problem is it uses a custom format: VW3D. The following code snippet is used to load the model from its File System. Is it possible to reconstruct the model format (and convert it) from the below snippet? I have no idea how I would go about this and would appreciate any pointers. My hope is to be able to construct a script to convert to/from this format (Planning for vw3d to obj and vice versa)</p> <pre><code>void eModel3D::ReadVW3D(const char *nName) { eFILE *file = 0; file = vw_fopen(nName); if (file == 0) return; size_t SizeB = strlen(nName)+1; Name = new char[SizeB]; strcpy(Name, nName); // пропускаем заголовок / skip header file-&gt;fread(&amp;DrawObjectCount, 4, 1); // читаем, сколько объектов read how many objects file-&gt;fread(&amp;DrawObjectCount, sizeof(int), 1); DrawObjectList = new eObjectBlock[DrawObjectCount]; unsigned int GlobalRangeStart = 0; // для каждого объекта for each object for (int i=0; i&lt;DrawObjectCount; i++) { DrawObjectList[i].RangeStart = GlobalRangeStart; // FVF_Format file-&gt;fread(&amp;(DrawObjectList[i].FVF_Format),sizeof(int),1); // Stride file-&gt;fread(&amp;(DrawObjectList[i].Stride),sizeof(int),1); // VertexCount на самом деле, это кол-во индексов на объект In fact, this count of the index on an object file-&gt;fread(&amp;(DrawObjectList[i].VertexCount),sizeof(int),1); GlobalRangeStart += DrawObjectList[i].VertexCount; // Location file-&gt;fread(&amp;(DrawObjectList[i].Location),sizeof(float)*3,1); // Rotation file-&gt;fread(&amp;(DrawObjectList[i].Rotation),sizeof(float)*3,1); // рисуем нормально, не прозрачным draw a fine, not transparent DrawObjectList[i].DrawType = 0; // вертексный буфер Vertex Buffer DrawObjectList[i].VertexBufferDestrType = 0; DrawObjectList[i].VertexBuffer = 0; DrawObjectList[i].VertexBufferVBO = 0; // индексный буфер Index buffer DrawObjectList[i].IndexBuffer = 0; DrawObjectList[i].IndexBufferVBO = 0; } // получаем сколько всего вертексов get how many verticies int VCount = 0; file-&gt;fread(&amp;VCount,sizeof(int),1); // собственно данные actual data GlobalVertexBuffer = new float[VCount*DrawObjectList[0].Stride]; file-&gt;fread(GlobalVertexBuffer, VCount*DrawObjectList[0].Stride*sizeof(float),1); // индекс буфер I.B. GlobalIndexBuffer = new unsigned int[GlobalRangeStart]; file-&gt;fread(GlobalIndexBuffer, GlobalRangeStart*sizeof(unsigned int),1); // делаем общее VBO making the total VBO GlobalVertexBufferVBO = new unsigned int; if (!vw_BuildVBO(VCount, GlobalVertexBuffer, DrawObjectList[0].Stride, GlobalVertexBufferVBO)) { delete GlobalVertexBufferVBO; GlobalVertexBufferVBO=0; } // делаем общий индекс VBO makes the overall index VBO GlobalIndexBufferVBO = new unsigned int; if (!vw_BuildIndexVBO(GlobalRangeStart, GlobalIndexBuffer, GlobalIndexBufferVBO)) { delete GlobalIndexBufferVBO; GlobalIndexBufferVBO=0; } // устанавливаем правильные указатели на массивы establish the correct pointers to arrays for (int i=0; i&lt;DrawObjectCount; i++) { DrawObjectList[i].VertexBuffer = GlobalVertexBuffer; DrawObjectList[i].VertexBufferVBO = GlobalVertexBufferVBO; DrawObjectList[i].IndexBuffer = GlobalIndexBuffer; DrawObjectList[i].IndexBufferVBO = GlobalIndexBufferVBO; } vw_fclose(file); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload