コード例 #1
0
// ***************************************************************************
void		CFarVertexBufferInfo::setupVertexBuffer(CVertexBuffer &vb, bool forVertexProgram)
{
	VertexFormat= vb.getVertexFormat();
	VertexSize= vb.getVertexSize();
	NumVertices= vb.getNumVertices();

	if(NumVertices==0)
	{
		setupNullPointers();
		return;
	}

	vb.lock (Accessor);
	VertexCoordPointer = Accessor.getVertexCoordPointer();

	if(forVertexProgram)
	{
		// With VertexCoordPointer setuped, init for VP.
		TexCoordOff0= vb.getValueOffEx(NL3D_LANDSCAPE_VPPOS_TEX0);				// v[8]= Tex0.
		TexCoordOff1= vb.getValueOffEx(NL3D_LANDSCAPE_VPPOS_TEX1);				// v[9]= Tex1.
		GeomInfoOff= vb.getValueOffEx(NL3D_LANDSCAPE_VPPOS_GEOMINFO);			// v[10]= GeomInfos.
		DeltaPosOff= vb.getValueOffEx(NL3D_LANDSCAPE_VPPOS_DELTAPOS);			// v[11]= EndPos-StartPos
		// Init Alpha Infos only if enabled (enabled if Value 5 are).
		AlphaInfoOff= 0;
		if( vb.getVertexFormat() & (1<<NL3D_LANDSCAPE_VPPOS_ALPHAINFO) )
			AlphaInfoOff= vb.getValueOffEx(NL3D_LANDSCAPE_VPPOS_ALPHAINFO);		// v[12]= AlphaInfos

		// update Ptrs.
		setupPointersForVertexProgram();
	}
	else
	{
		TexCoordOff0= vb.getTexCoordOff(0);
		TexCoordOff1= vb.getTexCoordOff(1);
		TexCoordPointer0= Accessor.getTexCoordPointer(0, 0);
		TexCoordPointer1= Accessor.getTexCoordPointer(0, 1);

		// In Far0, we don't have Color component.
		if(VertexFormat & CVertexBuffer::PrimaryColorFlag)
		{
			ColorOff= vb.getColorOff();
			// todo hulud d3d vertex color RGBA / BGRA
			ColorPointer= Accessor.getColorPointer();
		}
		else
		{
			ColorOff= 0;
			ColorPointer= NULL;
		}
	}

}
コード例 #2
0
// ***************************************************************************
void		CNearVertexBufferInfo::setupVertexBuffer(CVertexBuffer &vb, bool forVertexProgram)
{
	VertexFormat= vb.getVertexFormat();
	VertexSize= vb.getVertexSize();
	NumVertices= vb.getNumVertices();

	if(NumVertices==0)
	{
		setupNullPointers();
		return;
	}

	vb.lock (Accessor);
	VertexCoordPointer= Accessor.getVertexCoordPointer();

	if(forVertexProgram)
	{
		// With VertexCoordPointer setuped, init for VP.
		TexCoordOff0= vb.getValueOffEx(NL3D_LANDSCAPE_VPPOS_TEX0);				// v[8]= Tex0.
		TexCoordOff1= vb.getValueOffEx(NL3D_LANDSCAPE_VPPOS_TEX1);				// v[9]= Tex1.
		TexCoordOff2= vb.getValueOffEx(NL3D_LANDSCAPE_VPPOS_TEX2);				// v[13]= Tex1.
		GeomInfoOff= vb.getValueOffEx(NL3D_LANDSCAPE_VPPOS_GEOMINFO);			// v[10]= GeomInfos.
		DeltaPosOff= vb.getValueOffEx(NL3D_LANDSCAPE_VPPOS_DELTAPOS);			// v[11]= EndPos-StartPos

		// update Ptrs.
		setupPointersForVertexProgram();
	}
	else
	{
		TexCoordPointer0= Accessor.getTexCoordPointer(0, 0);
		TexCoordPointer1= Accessor.getTexCoordPointer(0, 1);
		TexCoordPointer2= Accessor.getTexCoordPointer(0, 2);

		TexCoordOff0= vb.getTexCoordOff(0);
		TexCoordOff1= vb.getTexCoordOff(1);
		TexCoordOff2= vb.getTexCoordOff(2);
	}
}