NLS Engine  v0.1
The Next Logical Step in game engine design.
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Defines
RenderModuleTexturesSystem.cpp
Go to the documentation of this file.
00001 
00012 #include "RenderModule.h"
00013 
00014 // Standard Includes
00015 #include <string>
00016 #include <deque>
00017 
00018 // Library Includes
00019 
00020 // Local Includes
00021 #include "../sharedbase/EventLogger.h"
00022 #include "../sharedbase/Envelope.h"
00023 
00024 #include "texture/TexturesSystemInterface.h"
00025 
00026 #include "Messages.h"
00027 
00028 // Typedefs and structs
00029 
00030 // Constants
00031 
00032 // Class Mathods
00033 namespace GraphicsCore {
00034   /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
00035   bool RenderModule::CreateTexture(EnvelopeSPTR incomingEnvelope, TexturesSystemInterface* object) const {
00036     const static unsigned int TEXTURE_MESSAGE_STRIDE = 2;
00037     
00038     int index = incomingEnvelope->GetCount();
00039     
00040     // If there's a texture's list, it should at least have some members!
00041     if (index >= TEXTURE_MESSAGE_STRIDE) {
00042       unsigned int texture_index;
00043       EnvelopeSPTR texture_spec;
00044       
00045       bool status = true;
00046       
00047       while ((index -= TEXTURE_MESSAGE_STRIDE) >= 0 && status) {
00048         texture_index = incomingEnvelope->GetDataUInt(        index + 0);
00049         texture_spec  = incomingEnvelope->GetDataEnvelopeSPTR(index + 1);
00050         
00051         status = object->InsertTexture(texture_index, texture_spec);
00052       }
00053       
00054       return status;
00055     }
00056     
00057     LOG(LOG_PRIORITY::INFO, "Attempted creation of a textures list without a texture!");
00058     
00059     return false;
00060   }
00061 }