NLS Engine  v0.1
The Next Logical Step in game engine design.
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Defines
Quad.h
Go to the documentation of this file.
00001 
00012 #pragma once
00013 
00014 // Standard Includes
00015 
00016 // Library Includes
00017 #include <d3d9.h>
00018 
00019 // Local Includes
00020 #include "../RenderableComponent.h"
00021 #include "../../material/MaterialsSystemInterface.h"
00022 #include "../../texture/TexturesSystemInterface.h"
00023 
00024 // Forward Declarations
00025 namespace GraphicsCore {
00026   class MaterialInterface;
00027   class TextureInterface;
00028 }
00029 
00030 // Typedefs
00031 
00032 // Constants
00033 namespace GraphicsCore {
00035   namespace ORIGIN {
00036     enum TYPE {
00037       UPPER_LEFT = 1, 
00038       CENTER 
00039     };
00040   }
00041   
00043   namespace ORIENTATION {
00044     enum TYPE {
00045       WORLD = 1, 
00046       CAMERA 
00047     };
00048   }
00049 }
00050 
00051 // Classes
00052 namespace GraphicsCore {
00053   class Quad : public RenderableComponent, public MaterialsSystemInterface, public TexturesSystemInterface {
00054   public:
00055     Quad(EntitySPTR, ModuleInterface*, LPDIRECT3DDEVICE9);
00056     virtual ~Quad(void);
00057     
00058     bool SetWidth(float);
00059     bool SetHeight(float);
00060     bool SetOrigin(ORIGIN::TYPE);
00061     bool SetOrientation(ORIENTATION::TYPE);
00062     
00063   private: // Overridden methods from parent classes
00064     void Render(LPDIRECT3DDEVICE9);
00065     
00066     bool InsertMaterial(unsigned int, EnvelopeSPTR);
00067     bool RemoveMaterial(unsigned int);
00068     
00069     bool InsertTexture(unsigned int, EnvelopeSPTR);
00070     bool RemoveTexture(unsigned int);
00071     
00072   private: // Internal utility methods
00073     void UpdateInstanceCache();
00074     
00075   private: // Object property cache - for performance
00076     static LPD3DXMESH mesh;
00077     
00078   private: // Class properties
00079     float width, height; 
00080     
00081     ORIGIN::TYPE originLocation;
00082     ORIENTATION::TYPE orientation;
00083     
00084     MaterialInterface* material;
00085     TextureInterface* texture;
00086     
00087   private: // Instance property cache - for performance
00088     D3DMATRIX matrix;
00089   };
00090 }