ivideo/rendermesh.h
Go to the documentation of this file.
00001 /* 00002 Copyright (C) 2002 by Marten Svanfeldt 00003 Anders Stenberg 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public 00016 License along with this library; if not, write to the Free 00017 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00018 */ 00019 00020 #ifndef __CS_IVIDEO_RENDERMESH_H__ 00021 #define __CS_IVIDEO_RENDERMESH_H__ 00022 00031 #include "csgeom/transfrm.h" 00032 #include "csgeom/vector3.h" 00033 00034 #include "iengine/material.h" 00035 #include "ivideo/graph3d.h" 00036 #include "ivideo/shader/shader.h" 00037 00038 struct iPortalContainer; 00039 00040 namespace CS 00041 { 00042 namespace Graphics 00043 { 00044 00045 typedef int RenderPriority; 00046 00047 enum MeshCullMode 00048 { 00049 cullNormal, 00050 cullFlipped, 00051 cullDisabled 00052 }; 00053 00059 static inline MeshCullMode GetFlippedCullMode (MeshCullMode cullMode) 00060 { 00061 switch (cullMode) 00062 { 00063 case cullNormal: return cullFlipped; 00064 case cullFlipped: return cullNormal; 00065 case cullDisabled: return cullDisabled; 00066 } 00067 // Should not happen ... 00068 return cullNormal; 00069 } 00070 00077 struct RenderMeshModes 00078 { 00079 RenderMeshModes () : z_buf_mode ((csZBufMode)~0), mixmode (CS_FX_COPY), 00080 renderPrio (-1), flipCulling (false), cullMode (cullNormal), 00081 alphaType (csAlphaMode::alphaNone) 00082 { 00083 } 00084 00085 RenderMeshModes (RenderMeshModes const& x) : 00086 z_buf_mode (x.z_buf_mode), 00087 mixmode (x.mixmode), 00088 renderPrio (x.renderPrio), 00089 flipCulling (x.flipCulling), 00090 cullMode (x.cullMode), 00091 alphaType (x.alphaType), 00092 buffers (x.buffers) 00093 { 00094 } 00095 00096 ~RenderMeshModes () { } 00097 00099 csZBufMode z_buf_mode; 00100 00102 uint mixmode; 00103 00105 RenderPriority renderPrio; 00106 00107 // Deprecated in 1.3. 00108 // ***NOTE*** Though deprecated, actual compiler-based deprecation is not 00109 // presently enabled since the inline constructors references this variable 00110 // and cause a Niagara of warnings to flood the build. Worse, even if 00111 // external projects fix their own code to avoid this variable, they still 00112 // get penalized by warnings because of the constructors (over which code 00113 // external projects have no control). One way to avoid this problem would be 00114 // to un-inline the constructors and then disable the deprecation warning 00115 // only when compiling the implementation file containing the constructors. A 00116 // potential difficulty with this approach, however, is that there is no 00117 // obvious location in the CS/libs hierarchy for such an implementation file 00118 // to reside. Since it is considered very unlikely that external projects 00119 // will be accessing this variable, and since un-inlining the constructors is 00120 // perhaps unnecessarily complicated, the decision was made instead to remove 00121 // the compiler-based deprecation attribute, but retain the 00122 // documentation-based deprecation warning. If real-world experience shows 00123 // that removing the compiler attribute was the wrong approach, then the 00124 // un-inlining approach can instead be implemented. 00125 // CS_DEPRECATED_VAR_MSG("Use cullMode instead", bool flipCulling ); 00126 bool flipCulling; 00127 00129 MeshCullMode cullMode; 00130 00132 csAlphaMode::AlphaType alphaType; 00133 00135 csRef<csRenderBufferHolder> buffers; 00136 }; 00137 00143 struct RenderMeshIndexRange 00144 { 00145 unsigned int start; 00146 unsigned int end; 00147 }; 00148 00152 struct CoreRenderMesh 00153 { 00158 const char* db_mesh_name; 00159 00160 CoreRenderMesh () : db_mesh_name ("<unknown>"), clip_portal (0), 00161 clip_plane (0), clip_z_plane (0), do_mirror (false), indexstart (0), 00162 indexend (0), multiRanges (0), rangesNum (0) 00163 { 00164 } 00165 00166 ~CoreRenderMesh () {} 00167 00169 int clip_portal; 00170 00172 int clip_plane; 00173 00175 int clip_z_plane; 00176 00177 // @@@ FIXME: should prolly be handled by component managing rendering 00194 bool do_mirror; 00195 00197 csRenderMeshType meshtype; 00198 00205 unsigned int indexstart; 00206 unsigned int indexend; 00212 RenderMeshIndexRange* multiRanges; 00214 size_t rangesNum; 00215 00220 iMaterialWrapper* material; 00221 00226 csReversibleTransform object2world; 00227 }; 00228 00233 struct RenderMesh : public CoreRenderMesh, public RenderMeshModes 00234 { 00235 RenderMesh () : geometryInstance (0), portal (0) 00236 { 00237 } 00238 00239 ~RenderMesh () {} 00240 00246 void *geometryInstance; 00247 00249 iPortalContainer* portal; 00250 00252 csRef<iShaderVariableContext> variablecontext; 00253 00255 csVector3 worldspace_origin; 00256 }; 00257 } // namespace Graphics 00258 } // namespace CS 00259 00260 typedef CS::Graphics::RenderMeshModes csRenderMeshModes; 00261 typedef CS::Graphics::CoreRenderMesh csCoreRenderMesh; 00262 typedef CS::Graphics::RenderMesh csRenderMesh; 00263 00266 #endif // __CS_IVIDEO_RENDERMESH_H__
Generated for Crystal Space 1.4.1 by doxygen 1.7.1