sphereEnvironmentProbe.h
Engine/source/T3D/lighting/sphereEnvironmentProbe.h
Classes:
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 SPHERE_ENVIRONMENT_PROBE_H 25#define SPHERE_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 SphereEnvironmentProbe : public ReflectionProbe 58{ 59 typedef ReflectionProbe Parent; 60 61public: 62 SphereEnvironmentProbe(); 63 virtual ~SphereEnvironmentProbe(); 64 65 // Declare this object as a ConsoleObject so that we can 66 // instantiate it into the world and network it 67 DECLARE_CONOBJECT(SphereEnvironmentProbe); 68 69 //-------------------------------------------------------------------------- 70 // Object Editing 71 // Since there is always a server and a client object in Torque and we 72 // actually edit the server object we need to implement some basic 73 // networking functions 74 //-------------------------------------------------------------------------- 75 // Set up any fields that we want to be editable (like position) 76 static void initPersistFields(); 77 78 // Allows the object to update its editable settings 79 // from the server object to the client 80 virtual void inspectPostApply(); 81 82 // Handle when we are added to the scene and removed from the scene 83 bool onAdd(); 84 void onRemove(); 85 86 // This function handles sending the relevant data from the server 87 // object to the client object 88 U32 packUpdate(NetConnection *conn, U32 mask, BitStream *stream); 89 // This function handles receiving relevant data from the server 90 // object and applying it to the client object 91 void unpackUpdate(NetConnection *conn, BitStream *stream); 92 93 //-------------------------------------------------------------------------- 94 // Object Rendering 95 // Torque utilizes a "batch" rendering system. This means that it builds a 96 // list of objects that need to render (via RenderInst's) and then renders 97 // them all in one batch. This allows it to optimized on things like 98 // minimizing texture, state, and shader switching by grouping objects that 99 // use the same Materials. 100 //-------------------------------------------------------------------------- 101 virtual void updateProbeParams(); 102 103 // This is the function that allows this object to submit itself for rendering 104 void prepRenderImage(SceneRenderState *state); 105 106 void setPreviewMatParameters(SceneRenderState* renderState, BaseMatInstance* mat); 107}; 108 109#endif // SPHERE_ENVIRONMENT_PROBE_H 110