NLS Engine  v0.1
The Next Logical Step in game engine design.
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Defines
RenderableComponent.cpp
Go to the documentation of this file.
00001 
00023 #include <cassert>
00024 #include <d3d9.h>
00025 #include <d3dx9tex.h>
00026 
00027 #include "RenderableComponent.h"
00028 #include "../RenderModule.h"
00029 
00030 namespace GraphicsCore {
00031   RenderableComponent::RenderableComponent(EntitySPTR owner, ModuleInterface* core) :
00032       ComponentInterface(owner, core) {
00033     space = CS_WORLD; // A reasonable default, as most objects will want to exist in the world, not on the screen.
00034 
00035     // Verify we have an existent RenderModule
00036     assert(RenderModule::GetRenderModule() != NULL);
00037     
00038     // Go get the current RenderModule, and store it away for later use.
00039     this->renderModule = RenderModule::GetRenderModule();
00040     
00041     // Register descendant with RenderModule
00042     this->renderModule->RegisterComponent(this);
00043   }
00044   
00045   RenderableComponent::~RenderableComponent() {
00046     // Unregister descendant from stored RenderModule
00047     this->renderModule->UnregisterComponent(this);
00048   }
00049   
00050   ECoordinateSpace RenderableComponent::GetCoordSpace() {
00051     return space;
00052   }
00053   
00054   bool RenderableComponent::SetCoordSpace(ECoordinateSpace space) {
00055     this->space = space;
00056     return true;
00057   }
00058 
00059 }