afxBillboard.h

Engine/source/afx/ce/afxBillboard.h

More...

Classes:

Public Defines

Public Typedefs

afxBillboard_BlendStyle 

Detailed Description

Public Defines

BLEND_UNDEFINED() 

Public Typedefs

typedef afxBillboardData::BlendStyle afxBillboard_BlendStyle 

Public Functions

DefineEnumType(afxBillboard_BlendStyle )

  1
  2
  3//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
  4// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames
  5// Copyright (C) 2015 Faust Logic, Inc.
  6//
  7// Permission is hereby granted, free of charge, to any person obtaining a copy
  8// of this software and associated documentation files (the "Software"), to
  9// deal in the Software without restriction, including without limitation the
 10// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 11// sell copies of the Software, and to permit persons to whom the Software is
 12// furnished to do so, subject to the following conditions:
 13//
 14// The above copyright notice and this permission notice shall be included in
 15// all copies or substantial portions of the Software.
 16//
 17// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 18// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 19// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 20// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 21// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 23// IN THE SOFTWARE.
 24//
 25//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
 26
 27#ifndef _AFX_BILLBOARD_H_
 28#define _AFX_BILLBOARD_H_
 29
 30#include "afx/afxEffectDefs.h"
 31
 32#define BLEND_UNDEFINED GFXBlend_COUNT
 33
 34class afxBillboardData : public GameBaseData, public afxEffectDefs
 35{
 36  typedef GameBaseData  Parent;
 37
 38public:
 39   // This enum specifies common blend settings with predefined values
 40   // for src/dst blend factors. 
 41   enum BlendStyle {
 42     BlendUndefined,
 43     BlendNormal,
 44     BlendAdditive,
 45     BlendSubtractive,
 46     BlendPremultAlpha,
 47     BlendUser,
 48   };
 49
 50public:
 51  StringTableEntry  txr_name;
 52  GFXTexHandle      txr;
 53
 54  LinearColorF            color;
 55  Point2F           texCoords[4];
 56  Point2F           dimensions;
 57  S32               blendStyle; 
 58  GFXBlend          srcBlendFactor;
 59  GFXBlend          dstBlendFactor;
 60
 61public:
 62  /*C*/             afxBillboardData();
 63  /*C*/             afxBillboardData(const afxBillboardData&, bool = false);
 64
 65  virtual void      packData(BitStream*);
 66  virtual void      unpackData(BitStream*);
 67
 68  bool              preload(bool server, String &errorStr);
 69
 70  virtual bool      allowSubstitutions() const { return true; }
 71
 72  static void       initPersistFields();
 73
 74  DECLARE_CONOBJECT(afxBillboardData);
 75  DECLARE_CATEGORY("AFX");
 76};
 77
 78typedef afxBillboardData::BlendStyle afxBillboard_BlendStyle;
 79DefineEnumType( afxBillboard_BlendStyle );
 80
 81
 82//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
 83// afxBillboard
 84
 85class afxBillboard : public GameBase, public afxEffectDefs
 86{
 87  typedef GameBase Parent;
 88  friend class afxEA_Billboard;
 89
 90private:
 91  afxBillboardData* mDataBlock;
 92
 93  F32               fade_amt;
 94  bool              is_visible;
 95  S8                sort_priority;
 96  LinearColorF            live_color;
 97
 98  GFXStateBlockRef  normal_sb;
 99  GFXStateBlockRef  reflected_sb;
100
101public:
102  /*C*/             afxBillboard();
103  /*D*/             ~afxBillboard();
104
105  virtual bool      onNewDataBlock(GameBaseData* dptr, bool reload);
106  virtual bool      onAdd();
107  virtual void      onRemove();
108
109  void              setFadeAmount(F32 amt) { fade_amt = amt; }
110  void              setSortPriority(S8 priority) { sort_priority = priority; }
111  void              setVisibility(bool flag) { is_visible = flag; }
112
113  virtual void      prepRenderImage(SceneRenderState*);
114
115  void              _renderBillboard(ObjectRenderInst*, SceneRenderState*, BaseMatInstance*);
116
117  DECLARE_CONOBJECT(afxBillboard);
118  DECLARE_CATEGORY("AFX");
119};
120
121//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
122
123#endif // _AFX_BILLBOARD_H_
124