00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef __BILLBOARDCOMPONENT_H__
00017 #define __BILLBOARDCOMPONENT_H__
00018
00019
00020 #include "../../dependencies.h"
00021 #include "SceneComponent.h"
00022
00023
00024
00026 class BillboardComponent : public SceneComponent
00027 {
00028 public:
00029
00030
00036 BillboardComponent(Entity *parent, const dimension2df &size = dimension2df(10.0f, 10.0f),
00037 const SColor &colorTop = SColor(255, 255, 255, 255),
00038 const SColor &colorBottom = SColor(255, 255, 255, 255));
00040 ~BillboardComponent();
00041
00042
00045 static BillboardComponent* refFactory(Entity *parent);
00048 static BillboardComponent* refFactory(Entity *parent, const dimension2df &size,
00049 const SColor &colorTop, const SColor &colorBottom);
00050
00051
00054 IBillboardSceneNode* getBillboardSceneNode();
00055
00059 void getColor(SColor &topColor, SColor &bottomColor) const;
00061 const dimension2df& getSize() const;
00062
00065 void setColor(const SColor &overallColor);
00069 void setColor(const SColor &topColor, const SColor &bottomColor);
00072 void setSize(const dimension2df &size);
00073
00074 protected:
00075
00076
00078 BillboardComponent(Entity *parent, bool isDerived);
00079
00080
00081 IBillboardSceneNode *mBillboardSN;
00082 };
00083
00084
00085
00087 extern void bindBillboardComponent(asIScriptEngine *engine);
00088
00091 template<typename T>
00092 void bindBillboardComponentBase(asIScriptEngine *engine, const char *type)
00093 {
00094
00095 int r;
00096 std::string sType = type;
00097
00098
00099 bindSceneComponentBase<BillboardComponent>(engine, type);
00100
00101
00102 r = engine->RegisterGlobalBehaviour(asBEHAVE_REF_CAST, std::string(sType + "@ f(BillboardComponent @)").c_str(),
00103 asFUNCTION((asRefCast<BillboardComponent,T>)), asCALL_CDECL); assert( r >= 0 );
00104 r = engine->RegisterGlobalBehaviour(asBEHAVE_IMPLICIT_REF_CAST, std::string("BillboardComponent@ f(" + sType +" @)").c_str(),
00105 asFUNCTION((asRefCast<T,BillboardComponent>)), asCALL_CDECL); assert( r >= 0 );
00106
00107
00108 r = engine->RegisterObjectMethod(type, "void getColor(SColor &out, SColor &out)",
00109 asMETHOD(T, getColor), asCALL_THISCALL); assert(r >= 0);
00110 r = engine->RegisterObjectMethod(type, "const dimension2df& getSize()",
00111 asMETHOD(T, getSize), asCALL_THISCALL); assert(r >= 0);
00112
00113 r = engine->RegisterObjectMethod(type, "void setColor(const SColor &in)",
00114 asMETHODPR(T, setColor, (const SColor&), void), asCALL_THISCALL); assert(r >= 0);
00115 r = engine->RegisterObjectMethod(type, "void setColor(const SColor &in, const SColor &in)",
00116 asMETHODPR(T, setColor, (const SColor&, const SColor&), void), asCALL_THISCALL); assert(r >= 0);
00117 r = engine->RegisterObjectMethod(type, "void setSize(const dimension2df &in)",
00118 asMETHOD(T, setSize), asCALL_THISCALL); assert(r >= 0);
00119 }
00120
00121 #endif