/* ** 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) 2001-2003 Electronic Arts Inc. // // // //////////////////////////////////////////////////////////////////////////////// // FILE: W3DBufferManager.h /////////////////////////////////////////////////////////////////////////// // Author: Mark Wilczynski // Desc: A system for managing partial vertex buffer allocations. /////////////////////////////////////////////////////////////////////////////////////////////////// #pragma once #ifndef _W3D_VERTEX_BUFFER_MANAGER #define _W3D_VERTEX_BUFFER_MANAGER #include "Lib/BaseType.h" #include "dx8vertexbuffer.h" #include "dx8indexbuffer.h" #define MAX_VB_SIZES 128 //number of different sized VB slots allowed. #define MIN_SLOT_SIZE 32 //minimum number of vertices allocated per slot (power of 2). See also MIN_SLOT_SIZE_SHIFT. #define MIN_SLOT_SIZE_SHIFT 5 //used for division by MIN_SLOT_SIZE #define MAX_VERTEX_BUFFERS_CREATED 32 //maximum number of D3D vertex buffers allowed to create per vertex type. #define DEFAULT_VERTEX_BUFFER_SIZE 8192 //this size ends up generating VB's of about 256Kbytes #define MAX_NUMBER_SLOTS 4096 //maximum number of slots that can be allocated. #define MAX_IB_SIZES 128 //number of different sized IB slots allowed (goes all the way up to 65536) #define MAX_INDEX_BUFFERS_CREATED 32 #define DEFAULT_INDEX_BUFFER_SIZE 32768 class W3DBufferManager { public: //List of all possible vertex formats available to the game. enum VBM_FVF_TYPES { VBM_FVF_XYZ, //position VBM_FVF_XYZD, //position, diffuse VBM_FVF_XYZUV, //position, uv VBM_FVF_XYZDUV, //position, diffuse, uv VBM_FVF_XYZUV2, //position, uv1, uv2 VBM_FVF_XYZDUV2, //position, diffuse, uv1, uv2 VBM_FVF_XYZN, //position, normal VBM_FVF_XYZND, //position, normal, diffuse VBM_FVF_XYZNUV, //position, normal, uv VBM_FVF_XYZNDUV, //position, normal, diffuse, uv VBM_FVF_XYZNUV2, //position, normal, uv1, uv2 VBM_FVF_XYZNDUV2, //position, normal, diffuse, uv1, uv2 VBM_FVF_XYZRHW, //transformed position VBM_FVF_XYZRHWD, //transformed position, diffuse VBM_FVF_XYZRHWUV, //transformed position, uv VBM_FVF_XYZRHWDUV, //transformed position, diffuse, uv VBM_FVF_XYZRHWUV2, //transformed position, uv1, uv2 VBM_FVF_XYZRHWDUV2, //transformed position, diffuse, uv1, uv2 MAX_FVF }; struct W3DRenderTask { W3DRenderTask *m_nextTask; ///m_nextVB; }; static Int getDX8Format(VBM_FVF_TYPES format); ///