Page MenuHomePhorge

ShaderTest.cpp
No OneTemporary

Size
2 KB
Referenced Files
None
Subscribers
None

ShaderTest.cpp

/*
* File: RenderTest.cpp
* Author: sean
*
* Created on 17-Aug-2014, 10:55:49
*/
#include <stdlib.h>
#include <iostream>
#include <echo/Graphics/Renderer.h>
#include <echo/Graphics/Scene.h>
#include <echo/Graphics/SceneEntity.h>
#include <echo/Graphics/Mesh.h>
#include <echo/Graphics/Camera.h>
#include <echo/Graphics/Viewport.h>
#include <echo/Graphics/Font.h>
#include <echo/Graphics/MultiRenderer.h>
#include <echo/Kernel/Kernel.h>
#include <echo/Resource/MeshManager.h>
#include <echo/Application.h>
#include <echo/FileSystem/FileSystem.h>
#include <echo/FileSystem/FileSystemSourceFile.h>
#include <echo/Resource/MaterialManager.h>
#include <echo/Graphics/RenderPass.h>
#include <echo/PlatformStub.h>
#include <echo/Chrono/CountDownTimer.h>
#include <boost/bind.hpp>
using namespace Echo;
class ShaderTest : public Application
{
public:
ShaderTest() : mTimeout(Seconds(30.0),boost::bind(&TaskManager::RemoveAllTasks,this),"RemoveAllTasks")
{
Initialise("RenderTest","data/ShaderTest.config");
//Load resource lists
GetMaterialManager()->LoadList(GetFileSystem()->Open("data/materials.list"));
shared_ptr<Camera> camera = mScene.CreateCamera();
camera->SetPosition(0,0,2);
camera->LookAt(0,0,0);
GetRenderer()->CreateRenderer(make_shared<Viewport>(0,0,1,1),camera);
AddTask(GetRenderer().get());
AddTask(mTimeout);
//Load a cube and clone it so we can have two cubes and use two different materials.
shared_ptr<Mesh> quad = GetMeshManager()->CreateMesh("Quad");
quad->CreateQuadSubMesh(1,1);
shared_ptr<Material> glow=GetMaterialManager()->GetResource("BasicShader");
//GetRenderTarget()->Activate();
//tRenderTarget()->BuildProgram(glow->GetPass(0)->GetProgram());
//GetRenderTarget()->Deactivate();
//glow=GetMaterialManager()->GetResource("Echo");
quad->SetMaterial(glow);
//Create a couple of Scene entities and set them up to use the cube meshes.
mEntity = shared_ptr< SceneEntity >(new SceneEntity());
mEntity->SetMesh(quad);
mScene.AddRenderable(mEntity);
}
private:
Scene mScene;
shared_ptr< SceneEntity > mEntity;
CountDownTimer mTimeout;
};
shared_ptr<Kernel> EchoInitialise()
{
shared_ptr<Application> application = shared_ptr<Application>(new ShaderTest());
return application;
}

File Metadata

Mime Type
text/x-c++
Expires
Thu, Jan 16, 1:06 AM (13 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
72113
Default Alt Text
ShaderTest.cpp (2 KB)

Event Timeline