Re: [Algorithms] VIPM With T&L - what about roam
Brought to you by:
vexxed72
From: Sam K. <sa...@ip...> - 2000-09-12 19:15:37
|
Jim, I though of exactly the same thing a couple of hours after I posed my last message! This will certainly do the trick. thanks. sam -----Original Message----- From: Jim Offerman <j.o...@in...> To: gda...@li... <gda...@li...> Date: 12 September 2000 7:50 AM Subject: Re: [Algorithms] VIPM With T&L - what about roam >> ... >> BUT, what about software transforms in situations where the split order is >> not known, i.e. VDPM or ROAM where polygons are denser towards the camera? >> you cant specify a range of verts for the software transform because it >> quite literally could be any of them. HT&L is fine because of the only >> transform indexed verts thing. >> >> Is there a solution to this? > >You could stream just the used vertices into a 'dynamic' vertexbuffer (i.e. >one you are using with the DISCARDCONTENTS paradigm) before rendering each >frame. Something like this: > >(pseudo code warnings apply) > >---- 8< ---- >void RenderDevice::Draw(Array<Vertex> &verts, Array<ushort> &indices) { > > struct VertInfo { > bool isUsed; // is this vertex used? > short newIndex; // new index of this vertex (after streaming). > }; > > static VertInfo vertInfos[/* max. nr. of verts */]; > static short newIndices[/* max. nr. of indices */]; > > // Clear all vertex info structures. > memset(vertInfos, 0, sizeof(VertInfo) * /* max. nr. of verts */); > > // Rebuild the vertex list, using *only* used vertices. > for (short i = 0; i < indices.GetLength(), i++) { > // Get current vertex index. > index = indices[i]; > // Check if we're using this vertex already... > if (vertInfos[index].isUsed == false) { > // If not, mark this vertex as used and remember it's index. > vertInfos[index].newIndex = i; > vertInfos[index].isUsed = true; > newIndices[i] = i; > // Write a vertex to our dynamic vertexbuffer > mDynVB->WriteVertex(i, verts[index]); > } > // Remap index. > newIndices[i] = verts[index].newIndex; > } > // Draw everything. > Draw(mDynVB, newIndices, indices.GetLength()); >} >---- 8< ---- > >It remains to be seen whether the above will actually speed up rendering, >but it could. > >Jim Offerman >Innovade > > >The Atlantis Project >http://www.theatlantisproject.com > >_______________________________________________ >GDAlgorithms-list mailing list >GDA...@li... >http://lists.sourceforge.net/mailman/listinfo/gdalgorithms-list |