1 /*
2     Copyright (c) 2008-2009 NetAllied Systems GmbH
3 
4 	This file is part of COLLADAMax.
5 
6     Portions of the code are:
7     Copyright (c) 2005-2007 Feeling Software Inc.
8     Copyright (c) 2005-2007 Sony Computer Entertainment America
9 
10     Based on the 3dsMax COLLADASW Tools:
11     Copyright (c) 2005-2006 Autodesk Media Entertainment
12 
13     Licensed under the MIT Open Source License,
14     for details please see LICENSE file or the website
15     http://www.opensource.org/licenses/mit-license.php
16 */
17 
18 
19 #ifndef __COLLADAMAX_TYPES_H__
20 #define __COLLADAMAX_TYPES_H__
21 
22 #include "COLLADAMaxPrerequisites.h"
23 
24 #include "COLLADABUURI.h"
25 #include "COLLADAFWTypes.h"
26 
27 #include <vector>
28 #include <map>
29 #include <set>
30 
31 class INode;
32 
33 namespace COLLADAMax
34 {
35 
36 	class ExportNode;
37 
38 	typedef std::vector<String> StringList;
39 
40 	struct EffectIdAndName
41 	{
EffectIdAndNameEffectIdAndName42 		EffectIdAndName( const String& _effectId, const String& _effectName )
43 			: effectId(_effectId)
44 			, effectName(_effectName)
45 		{}
46 
47 		String effectId;
48 		String effectName;
49 	};
50 
51 
52     /** A list of ids of effects that are exported*/
53     typedef std::vector<EffectIdAndName> ExportedEffectIdAndNameList;
54 
55     /** A list of wire frame colors that are exported*/
56     typedef std::vector<DWORD> WireFrameColorEffectList;
57 
58     /** Maps material pointers to effect ids*/
59     typedef std::map<Mtl*, String> EffectMap;
60 
61 	struct ImageInfo
62 	{
63 		/** The id of the image element in the COLLADA file.*/
64 		String imageId;
65 
66 		/** The location of the image to reference in the COLLADA image element.*/
67 		COLLADABU::URI fileLocation;
68 	};
69 
70     /**map<filename(original max absolute file location),imageID>*/
71 	typedef std::map<COLLADABU::URI, ImageInfo> ExportedImageMap;
72 
73 	/** List of INodes*/
74 	typedef std::vector<INode*> INodeList;
75 
76 	/** List of ImpNodes*/
77 	typedef std::vector<ImpNode*> ImpNodeList;
78 
79 	typedef std::set<ExportNode*> ExportNodeSet;
80 
81 	typedef std::vector<float> FloatList;
82 
83 
84 	typedef std::map<Object*, String> ObjectStringMap;
85 
86 	struct SkyLightParameters
87 	{
88 		float colorMapAmount;
89 		bool colorMapOn;
90 		int raysPerSample;
91 		float mode;
92 		float multiplier;
93 		float rayBias;
94 		bool castShadows;
95 		bool intensityOn;
96 	};
97 
98 	enum BumpType
99 	{
100 		BUMP_TYPE_INVALID,
101 		BUMP_TYPE_HEIGHTFIELD,
102 	};
103 
104 	struct BumpMap
105 	{
106 		//BumpMap() : bumpType(BUMP_TYPE_INVALID), textureAttributes(0) {}
107 		BumpType bumpType;
108 		COLLADAFW::TextureAttributes* textureAttributes;
109 	};
110 	struct EffectMaps
111 	{
112 		BumpMap mBumpMap;
113 	};
114 
115 
116 }
117 
118 // extra class ID from the samples (systems/sunlight/natLight.cpp)
119 #define SKY_LIGHT_CLASS_ID			Class_ID(0x7bf61478, 0x522e4705)
120 #define SKY_LIGHT_CLASS_ID_PART_A	0x7bf61478
121 
122 
123 
124 // Information found in the 3dsMax SDK from the 'light' object sample.
125 namespace MaxLight
126 {
127 	// reference #s
128 	const unsigned int PBLOCK_REF = 0;		// This is a IParamBlock
129 	const unsigned int PBLOCK_REF_SKY = 0;	// This is a IParamBlock2
130 	const unsigned int PROJMAP_REF = 1;
131 	const unsigned int SHADPROJMAP_REF = 2;
132 	const unsigned int SHADTYPE_REF = 3;
133 
134 	// Parameter block indices common to all lights (except SkyLight)
135 	const unsigned int PB_COLOR = 0;
136 	const unsigned int PB_INTENSITY = 1;
137 	const unsigned int PB_CONTRAST = 2;
138 	const unsigned int PB_DIFFSOFT = 3;
139 
140 	// Parameter block indices for non-OMNI lights.
141 	const unsigned int PB_HOTSIZE = 4;
142 	const unsigned int PB_FALLSIZE = 5;
143 	const unsigned int PB_ASPECT = 6;
144 	const unsigned int PB_ATTENSTART1 = 7;
145 	const unsigned int PB_ATTENEND1 = 8;
146 	const unsigned int PB_ATTENSTART = 9;
147 	const unsigned int PB_ATTENEND = 10;
148 	const unsigned int PB_DECAY = 11;
149 	const unsigned int PB_SHADCOLOR = 12;
150 	const unsigned int PB_ATMOS_SHAD = 13;
151 	const unsigned int PB_ATMOS_OPACITY = 14;
152 	const unsigned int PB_ATMOS_COLAMT = 15;
153 	const unsigned int PB_SHADMULT = 16;
154 	const unsigned int PB_SHAD_COLMAP = 17;
155 	const unsigned int PB_TDIST = 18;
156 
157 	// Parameter block indices for OMNI only
158 	const unsigned int PB_OMNIATSTART1 = 4;
159 	const unsigned int PB_OMNIATEND1 = 5;
160 	const unsigned int PB_OMNIATSTART = 6;
161 	const unsigned int PB_OMNIATEND = 7;
162 	const unsigned int PB_OMNIDECAY = 8;
163 	const unsigned int PB_OMNISHADCOLOR = 9;
164 	const unsigned int PB_OMNIATMOS_SHAD = 10;
165 	const unsigned int PB_OMNIATMOS_OPACITY = 11;
166 	const unsigned int PB_OMNIATMOS_COLAMT = 12;
167 	const unsigned int PB_OMNISHADMULT = 13;
168 	const unsigned int PB_OMNISHAD_COLMAP = 14;
169 
170 	// Parameter block indices for SkyLights (by looking at the ParamBlockDesc)
171 	const unsigned int PB_SKY_COLOR = 0;
172 	const unsigned int PB_SKY_SKY_COLOR_MAP_AMOUNT = 1;
173 	const unsigned int PB_SKY_COLOR_MAP = 2; // TYPE_TEXMAP
174 	const unsigned int PB_SKY_SKY_COLOR_MAP_ON = 3;
175 	const unsigned int PB_SKY_RAYS_PER_SAMPLE = 4;
176 	// baad food
177 	const unsigned int PB_SKY_MODE = 7; // ??
178 	// baad food
179 	const unsigned int PB_SKY_INTENSITY = 0xa;
180 	const unsigned int PB_SKY_RAY_BIAS = 0xb;
181 	const unsigned int PB_SKY_CAST_SHADOWS = 0xc;
182 	const unsigned int PB_SKY_MULTIPLIER_ON = 0xd;
183 };
184 
185 
186 
187 
188 #endif //__COLLADAMAX_TYPES_H__
189