/*
** Command & Conquer Renegade(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 .
*/
#include "dx8fvf.h"
#include "wwstring.h"
#include
static unsigned Get_FVF_Vertex_Size(unsigned FVF)
{
return D3DXGetFVFVertexSize(FVF);
}
FVFInfoClass::FVFInfoClass(unsigned FVF_)
:
FVF(FVF_),
fvf_size(Get_FVF_Vertex_Size(FVF))
{
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