kick
/Users/morten/Programmering/cpp/kick/src/kick/scene/skybox.cpp
00001 //
00002 // Created by Morten Nobel-Jørgensen on 31/10/14.
00003 //
00004 
00005 #include "skybox.h"
00006 #include <iostream>
00007 
00008 using namespace std;
00009 
00010 kick::Skybox::Skybox(GameObject *gameObject)
00011         : ComponentRenderable(gameObject),
00012           mMeshRenderer{new MeshRenderer(gameObject)},
00013           mMesh{new Mesh()}
00014 
00015 {
00016     mMesh->setMeshData(MeshFactory::createCubeData(2));
00017     mMeshRenderer->setMesh(mMesh);
00018 }
00019 
00020 kick::Skybox::~Skybox() {
00021     delete mMeshRenderer;
00022 }
00023 
00024 void kick::Skybox::render(kick::EngineUniforms *engineUniforms, kick::Material *replacementMaterial) {
00025     if (!replacementMaterial){
00026 #if defined(KICK_CONTEXT_ES2)
00027         glDepthRangef(0.99999f,1);
00028 #else
00029         glDepthRange(0.99999f,1);
00030 #endif
00031         mMeshRenderer->render(engineUniforms, nullptr);
00032 #if defined(KICK_CONTEXT_ES2)
00033         glDepthRangef(0,1);  // default
00034 #else
00035         glDepthRange(0,1);  // default
00036 #endif
00037     }
00038 }
00039 
00040 int kick::Skybox::renderOrder() {
00041     return 1999;
00042 }
00043 
00044 kick::Material *kick::Skybox::material() const {
00045     return mMeshRenderer->material();
00046 }
00047 
00048 void kick::Skybox::setMaterial(kick::Material *material) {
00049     mMeshRenderer->setMaterial(material);
00050 }
 All Classes Functions Variables