boxEnvironmentProbe.h
Engine/source/T3D/lighting/boxEnvironmentProbe.h
Classes:
class
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 BOX_ENVIRONMENT_PROBE_H 25#define BOX_ENVIRONMENT_PROBE_H 26 27#ifndef REFLECTIONPROBE_H 28#include "T3D/lighting/reflectionProbe.h" 29#endif 30#ifndef _GFXVERTEXBUFFER_H_ 31#include "gfx/gfxVertexBuffer.h" 32#endif 33#ifndef _GFXPRIMITIVEBUFFER_H_ 34#include "gfx/gfxPrimitiveBuffer.h" 35#endif 36#ifndef _TSSHAPEINSTANCE_H_ 37#include "ts/tsShapeInstance.h" 38#endif 39#include "lighting/lightInfo.h" 40 41#ifndef _RENDERPASSMANAGER_H_ 42#include "renderInstance/renderPassManager.h" 43#endif 44 45class BaseMatInstance; 46 47 48//----------------------------------------------------------------------------- 49// This class implements a basic SceneObject that can exist in the world at a 50// 3D position and render itself. There are several valid ways to render an 51// object in Torque. This class implements the preferred rendering method which 52// is to submit a MeshRenderInst along with a Material, vertex buffer, 53// primitive buffer, and transform and allow the RenderMeshMgr handle the 54// actual setup and rendering for you. 55//----------------------------------------------------------------------------- 56 57class BoxEnvironmentProbe : public ReflectionProbe 58{ 59 typedef ReflectionProbe Parent; 60 F32 mAtten; 61private: 62 63 //Debug rendering 64 static bool smRenderPreviewProbes; 65 66public: 67 BoxEnvironmentProbe(); 68 virtual ~BoxEnvironmentProbe(); 69 70 // Declare this object as a ConsoleObject so that we can 71 // instantiate it into the world and network it 72 DECLARE_CONOBJECT(BoxEnvironmentProbe); 73 74 //-------------------------------------------------------------------------- 75 // Object Editing 76 // Since there is always a server and a client object in Torque and we 77 // actually edit the server object we need to implement some basic 78 // networking functions 79 //-------------------------------------------------------------------------- 80 // Set up any fields that we want to be editable (like position) 81 static void initPersistFields(); 82 83 // Allows the object to update its editable settings 84 // from the server object to the client 85 virtual void inspectPostApply(); 86 87 // Handle when we are added to the scene and removed from the scene 88 bool onAdd(); 89 void onRemove(); 90 91 // This function handles sending the relevant data from the server 92 // object to the client object 93 U32 packUpdate(NetConnection *conn, U32 mask, BitStream *stream); 94 // This function handles receiving relevant data from the server 95 // object and applying it to the client object 96 void unpackUpdate(NetConnection *conn, BitStream *stream); 97 98 //-------------------------------------------------------------------------- 99 // Object Rendering 100 // Torque utilizes a "batch" rendering system. This means that it builds a 101 // list of objects that need to render (via RenderInst's) and then renders 102 // them all in one batch. This allows it to optimized on things like 103 // minimizing texture, state, and shader switching by grouping objects that 104 // use the same Materials. 105 //-------------------------------------------------------------------------- 106 virtual void updateProbeParams(); 107 108 // This is the function that allows this object to submit itself for rendering 109 //void prepRenderImage(SceneRenderState *state); 110 111 void setPreviewMatParameters(SceneRenderState* renderState, BaseMatInstance* mat); 112}; 113 114#endif // BOX_ENVIRONMENT_PROBE_H 115