00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include "asTerrainComponent.h"
00018
00019 #ifdef __COMPILE_WITH_ANGELSCRIPT__
00020
00021 #include "../../ScriptHelper.h"
00022 #include "asSceneComponent.h"
00023
00024 #include "../../../components/scene/TerrainComponent.h"
00025
00026
00028 TerrainComponent* createTerrainComponent(Entity *parent)
00029 {
00030 return new TerrainComponent(parent);
00031 }
00032
00034 TerrainComponent* createTerrainComponent(Entity *parent, const std::string &fileName,
00035 const vector3df &scale, const SColor &vertexColor,
00036 s32 maxLOD, s32 smoothFactor)
00037 {
00038 return new TerrainComponent(parent, fileName, scale, vertexColor, maxLOD, smoothFactor);
00039 }
00040
00042 void bindTerrainComponent(asIScriptEngine *engine)
00043 {
00044
00045 int r;
00046
00047
00048 r = engine->RegisterObjectType("TerrainComponent", sizeof(TerrainComponent), asOBJ_REF); assert(r >= 0);
00049
00050
00051 bindSceneComponentBase<TerrainComponent>(engine, "TerrainComponent");
00052
00053
00054 r = engine->RegisterObjectBehaviour("TerrainComponent", asBEHAVE_FACTORY, "TerrainComponent@ f(Entity @+)",
00055 asFUNCTIONPR(createTerrainComponent, (Entity*), TerrainComponent*),
00056 asCALL_CDECL); assert(r >= 0);
00057 r = engine->RegisterObjectBehaviour("TerrainComponent", asBEHAVE_FACTORY, "TerrainComponent@ f(Entity @+, " \
00058 "const string &in, const vector3df &in, const SColor &in, s32, s32)",
00059 asFUNCTIONPR(createTerrainComponent, (Entity*, const std::string &,
00060 const vector3df &, const SColor &, s32, s32), TerrainComponent*),
00061 asCALL_CDECL); assert(r >= 0);
00062
00063 r = engine->RegisterObjectMethod("TerrainComponent", "TerrainComponent& opAssign(const TerrainComponent &in)",
00064 asFUNCTION(assignT<TerrainComponent>), asCALL_CDECL_OBJFIRST); assert(r >= 0);
00065
00066
00067 r = engine->RegisterObjectMethod("TerrainComponent", "const aabbox3df& getBoundingBox(s32, s32)",
00068 asMETHODPR(TerrainComponent, getBoundingBox, (s32, s32) const, const aabbox3df&),
00069 asCALL_THISCALL); assert(r >= 0);
00070 r = engine->RegisterObjectMethod("TerrainComponent", "f32 getHeight(f32, f32)",
00071 asMETHOD(TerrainComponent, getHeight), asCALL_THISCALL); assert(r >= 0);
00072 r = engine->RegisterObjectMethod("TerrainComponent", "const vector3df& getTerrainCenter()",
00073 asMETHOD(TerrainComponent, getTerrainCenter), asCALL_THISCALL); assert(r >= 0);
00074 r = engine->RegisterObjectMethod("TerrainComponent", "bool loadHeightMap(const string &in, const SColor &in, s32)",
00075 asMETHOD(TerrainComponent, loadHeightMap), asCALL_THISCALL); assert(r >= 0);
00076 r = engine->RegisterObjectMethod("TerrainComponent", "void scaleTexture(f32, f32)",
00077 asMETHOD(TerrainComponent, scaleTexture), asCALL_THISCALL); assert(r >= 0);
00078 }
00079
00080 #endif // __COMPILE_WITH_ANGELSCRIPT__
00081
00082