00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "SkyDomeComponent.h"
00019 #include "../../core/GameManager.h"
00020
00021
00022
00023
00024 SkyDomeComponent::SkyDomeComponent(Entity *parent, const std::string &fileName, u32 hRes, u32 vRes,
00025 f32 texturePerc, f32 spherePerc, f32 radius)
00026 : SceneComponent(parent, true)
00027 {
00028
00029 ISceneManager *pSceneMgr = GameManager::Instance()->getSceneManager();
00030 IVideoDriver *pDriver = GameManager::Instance()->getDriver();
00031
00032
00033 mSceneNode = pSceneMgr->addSkyDomeSceneNode(pDriver->getTexture(fileName.c_str()), hRes, vRes,
00034 texturePerc, spherePerc, radius, 0, parent->getID());
00035
00036
00037 mTriSelector = NULL;
00038 mMetaSelector = NULL;
00039 }
00040
00041
00042 SkyDomeComponent::SkyDomeComponent(Entity *parent, ITexture *texture, u32 hRes, u32 vRes,
00043 f32 texturePerc, f32 spherePerc, f32 radius)
00044 : SceneComponent(parent, true)
00045 {
00046
00047 ISceneManager *pSceneMgr = GameManager::Instance()->getSceneManager();
00048
00049
00050 mSceneNode = pSceneMgr->addSkyDomeSceneNode(texture, hRes, vRes, texturePerc, spherePerc,
00051 radius, 0, parent->getID());
00052
00053
00054 mTriSelector = NULL;
00055 mMetaSelector = NULL;
00056 }
00057
00058
00059 SkyDomeComponent::~SkyDomeComponent()
00060 {
00061 }
00062
00063
00064 SkyDomeComponent* SkyDomeComponent::refFactory(Entity *parent, const std::string &fileName,
00065 u32 hRes, u32 vRes, f32 texturePerc, f32 spherePerc,
00066 f32 radius)
00067 {
00068 return new SkyDomeComponent(parent, fileName, hRes, vRes, texturePerc, spherePerc, radius);
00069 }
00070
00071
00072
00073 void bindSkyDomeComponent(asIScriptEngine *engine)
00074 {
00075
00076 int r;
00077
00078
00079 r = engine->RegisterObjectType("SkyDomeComponent", sizeof(SkyDomeComponent), asOBJ_REF); assert(r >= 0);
00080
00081
00082 bindSceneComponentBase<SkyDomeComponent>(engine, "SkyDomeComponent");
00083
00084
00085 r = engine->RegisterObjectBehaviour("SkyDomeComponent", asBEHAVE_FACTORY, "SkyDomeComponent@ f(Entity @, " \
00086 "const string &, u32, u32, f32, f32, f32)",
00087 asFUNCTIONPR(SkyDomeComponent::refFactory, (Entity*, const std::string&,
00088 u32, u32, f32, f32, f32), SkyDomeComponent*), asCALL_CDECL); assert(r >= 0);
00089 }
00090
00091