1 /* 2 =========================================================================== 3 4 Doom 3 GPL Source Code 5 Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 6 7 This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code"). 8 9 Doom 3 Source Code is free software: you can redistribute it and/or modify 10 it under the terms of the GNU General Public License as published by 11 the Free Software Foundation, either version 3 of the License, or 12 (at your option) any later version. 13 14 Doom 3 Source Code is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 GNU General Public License for more details. 18 19 You should have received a copy of the GNU General Public License 20 along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>. 21 22 In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. 23 24 If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 26 =========================================================================== 27 */ 28 #pragma once 29 30 /** 31 * Represents a single attribute in a material. Represents material, stage 32 * and special stage attributes. The MaterialDef manager loads these 33 * definitions from the material definition file as the editor 34 * is being initialized. 35 */ 36 class MaterialDef { 37 38 public: 39 /** 40 * Defines possible attribute types. 41 */ 42 enum { 43 MATERIAL_DEF_TYPE_GROUP, 44 MATERIAL_DEF_TYPE_BOOL, 45 MATERIAL_DEF_TYPE_STRING, 46 MATERIAL_DEF_TYPE_FLOAT, 47 MATERIAL_DEF_TYPE_INT 48 }; 49 50 int type; 51 idStr dictName; 52 idStr displayName; 53 idStr displayInfo; 54 bool quotes; 55 idHashTable<DWORD> viewData; 56 57 public: 58 59 MaterialDef(void); 60 virtual ~MaterialDef(void); 61 62 DWORD GetViewData(const char* viewName); 63 void SetViewData(const char* viewName, DWORD value); 64 }; 65 66 /** 67 * A list of material attributes. Material, stage, and special stage attributes 68 * are grouped together during the load process for use by the different view and 69 * MaterialDoc. 70 */ 71 typedef idList<MaterialDef*> MaterialDefList; 72 73 /** 74 * This class contains static utility functions that view and MaterialDoc use 75 * to access the MaterialDef and MaterialDefList data that is loaded. This class 76 * is also responsible for loading and destroying the MaterialDef instances. 77 */ 78 class MaterialDefManager { 79 80 public: 81 82 /** 83 * Defines the groupings of material attributes. 84 */ 85 enum { 86 MATERIAL_DEF_MATERIAL = 0, 87 MATERIAL_DEF_STAGE, 88 MATERIAL_DEF_SPECIAL_STAGE, 89 MATERIAL_DEF_NUM 90 }; 91 92 static void InitializeMaterialDefLists(); 93 static void InitializeMaterialDefList(idLexer* src, const char* typeName, MaterialDefList* list); 94 95 static void DestroyMaterialDefLists(); 96 97 static MaterialDefList* GetMaterialDefs(int type); 98 99 100 protected: 101 static MaterialDefList materialDefs[MATERIAL_DEF_NUM]; 102 }; 103