cubemapData.h

Engine/source/gfx/sim/cubemapData.h

More...

Classes:

class

A script interface for creating static or dynamic cubemaps.

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 _CUBEMAPDATA_H_
25#define _CUBEMAPDATA_H_
26
27#ifndef _SIMOBJECT_H_
28#include "console/simObject.h"
29#endif
30
31#ifndef _GFXCUBEMAP_H_
32#include "gfx/gfxCubemap.h"
33#endif
34
35#ifndef _GFXTARGET_H_
36#include "gfx/gfxTarget.h"
37#endif
38
39#ifndef _SCENEMANAGER_H_
40#include "scene/sceneManager.h"
41#endif
42
43
44/// A script interface for creating static or dynamic cubemaps.
45class CubemapData : public SimObject
46{
47   typedef SimObject Parent;   
48
49public:   
50
51   GFXCubemapHandle  mCubemap;
52
53   CubemapData();
54   ~CubemapData();
55
56   bool onAdd();
57   static void initPersistFields();
58
59   DECLARE_CONOBJECT(CubemapData);
60
61   // Force creation of cubemap
62   void createMap();   
63
64   // Update a static cubemap @ pos
65   void updateFaces();
66
67   void setCubemapFile(FileName newCubemapFile);
68
69   void setCubeFaceFile(U32 index, FileName newFaceFile);
70
71   void setCubeFaceTexture(U32 index, GFXTexHandle newFaceTexture);
72
73   GFXTexHandle* getCubeMapFace(U32 faceIdx) { return &mCubeFace[faceIdx]; }
74
75protected:
76   FileName mCubeMapFile;
77   FileName mCubeFaceFile[6];
78   GFXTexHandle mCubeFace[6];
79
80   GFXTexHandle mDepthBuff;
81   GFXTextureTargetRef mRenderTarget;
82};
83
84#endif // CUBEMAPDATA
85