Torque3D Documentation / _generateds / coreInterfaces.h

coreInterfaces.h

Engine/source/T3D/components/coreInterfaces.h

More...

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 CORE_INTERFACES_H
 25#define CORE_INTERFACES_H
 26
 27#ifndef _SCENERENDERSTATE_H_
 28#include "scene/sceneRenderState.h"
 29#endif
 30
 31template<typename T>
 32class Interface
 33{
 34public:
 35   static Vector<T*> all;
 36
 37   Interface()
 38   {
 39      all.push_back((T*)this);
 40   }
 41   virtual ~Interface()
 42   {
 43      for (U32 i = 0; i < all.size(); i++)
 44      {
 45         if (all[i] == (T*)this)
 46         {
 47            all.erase(i);
 48            return;
 49         }
 50      }
 51   }
 52};
 53template<typename T> Vector<T*> Interface<T>::all(0);
 54
 55//Basically a file for generic interfaces that many behaviors may make use of
 56class SetTransformInterface// : public Interface<SetTransformInterface>
 57{
 58public:
 59   virtual void setTransform( MatrixF transform );
 60   virtual void setTransform( Point3F pos, EulerF rot );
 61};
 62
 63class UpdateInterface : public Interface<UpdateInterface>
 64{
 65public:
 66   virtual void processTick(){}
 67   virtual void interpolateTick(F32 dt){}
 68   virtual void advanceTime(F32 dt){}
 69};
 70
 71class BehaviorFieldInterface// : public Interface<BehaviorFieldInterface>
 72{
 73public:
 74   virtual void onFieldChange(const char* fieldName, const char* newValue){};
 75};
 76
 77class CameraInterface// : public Interface<CameraInterface>
 78{
 79public:
 80   virtual bool getCameraTransform(F32* pos,MatrixF* mat)=0;
 81   virtual void onCameraScopeQuery(NetConnection *cr, CameraScopeQuery * query)=0;
 82   virtual Frustum getFrustum()=0;
 83   virtual F32 getCameraFov()=0;
 84   virtual void setCameraFov(F32 fov)=0;
 85
 86   virtual bool isValidCameraFov(F32 fov)=0;
 87};
 88
 89class CastRayInterface// : public Interface<CastRayInterface>
 90{
 91public:
 92   virtual bool castRay(const Point3F &start, const Point3F &end, RayInfo* info)=0;
 93};
 94
 95class EditorInspectInterface// : public Interface<EditorInspectInterface>
 96{
 97public:
 98   virtual void onInspect()=0;
 99   virtual void onEndInspect()=0;
100};
101
102#endif
103