NLS Engine  v0.1
The Next Logical Step in game engine design.
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Defines
BasicMaterial.cpp
Go to the documentation of this file.
00001 
00010 #pragma once
00011 
00012 #include "BasicMaterial.h"
00013 
00014 // Standard Includes
00015 #include <string>
00016 
00017 // Library Includes
00018 #include <d3d9.h>
00019 
00020 // Local Includes
00021 
00022 // Forward Declarations
00023 
00024 // Typedefs
00025 
00026 namespace GraphicsCore {
00027   BasicMaterial::BasicMaterial() {
00028     this->Init(BLANK_MATERIAL);
00029   }
00030   
00031   BasicMaterial::BasicMaterial(Color diffuse, Color ambient, Color specular, Color emissive, float power) {
00032     Material material = {diffuse, ambient, specular, emissive, power};
00033     this->Init(material);
00034   }
00035   
00036   BasicMaterial::BasicMaterial(Material& material) {
00037     this->Init(material);
00038   }
00039   
00040   BasicMaterial::~BasicMaterial() {
00041   }
00042   
00043   /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
00044   void BasicMaterial::Apply(LPDIRECT3DDEVICE9 pd3d_device) {
00045     pd3d_device->SetMaterial(&(this->material));
00046   }
00047   
00048   /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
00049   void BasicMaterial::Init(Material material) {
00050     // *NOTE: This winds up doing a form of deep copy because the parameter is a pass-by-value.  This is wanted, and if it doesn't happen there may be consequences.
00051     this->material = material;
00052   }
00053 }