tsSortedMesh.h
Engine/source/ts/tsSortedMesh.h
Classes:
class
TSSortedMesh is for meshes that need sorting (obviously).
class
This is a group of primitives that belong "together" in the rendering sequence.
Detailed Description
1 2//----------------------------------------------------------------------------- 3// Copyright (c) 2012 GarageGames, LLC 4// 5// Permission is hereby granted, free of charge, to any person obtaining a copy 6// of this software and associated documentation files (the "Software"), to 7// deal in the Software without restriction, including without limitation the 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 9// sell copies of the Software, and to permit persons to whom the Software is 10// furnished to do so, subject to the following conditions: 11// 12// The above copyright notice and this permission notice shall be included in 13// all copies or substantial portions of the Software. 14// 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21// IN THE SOFTWARE. 22//----------------------------------------------------------------------------- 23 24#ifndef _TSSORTEDMESH_H_ 25#define _TSSORTEDMESH_H_ 26 27#ifndef _TSMESH_H_ 28#include "ts/tsMesh.h" 29#endif 30 31/// TSSortedMesh is for meshes that need sorting (obviously). Such meshes 32/// are usually partially or completely composed of translucent/parent polygons. 33class TSSortedMesh : public TSMesh 34{ 35public: 36 typedef TSMesh Parent; 37 38 /// This is a group of primitives that belong "together" in the rendering sequence. 39 /// For example, if a player model had a helmet with a translucent visor, the visor 40 /// would be a Cluster. 41 struct Cluster 42 { 43 S32 startPrimitive; 44 S32 endPrimitive; 45 Point3F normal; 46 F32 k; 47 S32 frontCluster; ///< go to this cluster if in front of plane, if frontCluster<0, no cluster 48 S32 backCluster; ///< go to this cluster if in back of plane, if backCluster<0, no cluster 49 ///< if frontCluster==backCluster, no plane to test against... 50 }; 51 52 Vector<Cluster> clusters; ///< All of the clusters of primitives to be drawn 53 Vector<S32> startCluster; ///< indexed by frame number 54 Vector<S32> firstVerts; ///< indexed by frame number 55 Vector<S32> numVerts; ///< indexed by frame number 56 Vector<S32> firstTVerts; ///< indexed by frame number or matFrame number, depending on which one animates (never both) 57 58 /// sometimes, we want to write the depth value to the frame buffer even when object is translucent 59 bool alwaysWriteDepth; 60 61 // render methods.. 62 void render(S32 frame, S32 matFrame, TSMaterialList *); 63 64 bool buildPolyList( S32 frame, AbstractPolyList *polyList, U32 &surfaceKey, TSMaterialList *materials ); 65 bool castRay( S32 frame, const Point3F &start, const Point3F &end, RayInfo *rayInfo, TSMaterialList *materials ); 66 bool buildConvexHull(); ///< does nothing, skins don't use this 67 /// 68 /// @returns false ALWAYS 69 S32 getNumPolys(); 70 71 void assemble(bool skip); 72 void disassemble(); 73 74 TSSortedMesh() { 75 alwaysWriteDepth = false; 76 mMeshType = SortedMeshType; 77 } 78}; 79 80#endif // _TS_SORTED_MESH 81 82 83