NLS Engine  v0.1
The Next Logical Step in game engine design.
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Defines
TextureAdjustable.h
Go to the documentation of this file.
00001 
00010 #pragma once
00011 
00012 // Standard Includes
00013 #include <string>
00014 
00015 // Library Includes
00016 #include <d3dx9tex.h>
00017 #include <threading.h>
00018 
00019 // Local Includes
00020 #include "TextureInterface.h"
00021 #include "../../sharedbase/Envelope_fwd.h"
00022 
00023 // Forward Declarations
00024 class MessageRouter;
00025 
00026 namespace GraphicsCore {
00027   class RenderModule;
00028 }
00029 
00030 // Typedefs/types
00031 namespace GraphicsCore {
00032   struct TextureAdjustableData {
00033     D3DXVECTOR2 scale;
00034     D3DXVECTOR2 translation;
00035     float sinRotation, cosRotation;
00036     TextureInterface* texture;
00037     
00038     mutable Threading::ReadWriteMutex mutex;
00039   };
00040   typedef std::shared_ptr<TextureAdjustableData> TextureAdjustableDataPointer;
00041   
00042   struct SwapMarker {
00043     bool needed;
00044     mutable Threading::ReadWriteMutex mutex;
00045   };
00046 }
00047 
00048 // Class
00049 namespace GraphicsCore {
00050   class TextureAdjustable : public TextureInterface {
00051   public:
00053     TextureAdjustable(TextureInterface*, MessageRouter*, RenderModule*);
00054     ~TextureAdjustable();
00055     
00056     bool SetMessageId(unsigned int);
00057     
00058   private: // Inherited interface function implementations should be private to help the compiler detect potential issues if the interface changes.
00059     void Apply(LPDIRECT3DDEVICE9);
00060     
00061   private:
00062     void MessageHandler(EnvelopeSPTR);
00063     
00064   private:
00065     TextureAdjustableDataPointer primaryBuffer;
00066     TextureAdjustableDataPointer secondaryBuffer;
00067     SwapMarker swap;
00068     
00069     D3DXMATRIX currentMatrix;
00070     
00071     MessageRouter* messageRouter;
00072     RenderModule* renderModule;
00073     
00074     unsigned int messageTypeId;
00075   };
00076 }