/*
** Command & Conquer Generals Zero Hour(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see .
*/
/***********************************************************************************************
*** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
***********************************************************************************************
* *
* Project Name : ww3d *
* *
* $Archive:: /Commando/Code/ww3d2/dx8fvf.h $*
* *
* Original Author:: Jani Penttinen *
* *
* $Author:: Kenny Mitchell *
* *
* $Modtime:: 06/26/02 5:06p $*
* *
* $Revision:: 7 $*
* *
* 06/26/02 KM VB Vertex format update for shaders *
* 07/17/02 KM VB Vertex format update for displacement mapping *
* 08/01/02 KM VB Vertex format update for cube mapping *
*---------------------------------------------------------------------------------------------*
* Functions: *
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#include "dx8fvf.h"
#include "wwstring.h"
#include
static unsigned Get_FVF_Vertex_Size(unsigned FVF)
{
return D3DXGetFVFVertexSize(FVF);
}
FVFInfoClass::FVFInfoClass(unsigned FVF_, unsigned vertex_size)
:
FVF(FVF_),
fvf_size(FVF!=0 ? Get_FVF_Vertex_Size(FVF) : vertex_size)
{
location_offset=0;
blend_offset=location_offset;
if ((FVF&D3DFVF_XYZ)==D3DFVF_XYZ) blend_offset+=3*sizeof(float);
normal_offset=blend_offset;
if ( ((FVF&D3DFVF_XYZB4)==D3DFVF_XYZB4) &&
((FVF&D3DFVF_LASTBETA_UBYTE4)==D3DFVF_LASTBETA_UBYTE4) ) normal_offset+=3*sizeof(float)+sizeof(DWORD);
diffuse_offset=normal_offset;
if ((FVF&D3DFVF_NORMAL)==D3DFVF_NORMAL) diffuse_offset+=3*sizeof(float);
specular_offset=diffuse_offset;
if ((FVF&D3DFVF_DIFFUSE)==D3DFVF_DIFFUSE) specular_offset+=sizeof(DWORD);
texcoord_offset[0]=specular_offset;
if ((FVF&D3DFVF_SPECULAR)==D3DFVF_SPECULAR) texcoord_offset[0]+=sizeof(DWORD);
for (unsigned int i=1; i