Попробывал сделать пост фильтер,вроде получается,пост филтер простой Black & White
struct Input{
float2 texcoord : TEXCOORD0;
};
struct Output{
float4 color : COLOR0;
};
void main( in Input In , out Output Out , uniform float4 materialColor , uniform sampler2D texture0 ){
float saturation = .1f;
float4 color = tex2D(texture0,In.texcoord);
float grayscale = color.r * 0.3 + color.g * 0.59 + color.b * 0.11;
float satgray = clamp(grayscale*(1.0-saturation),0.0,1.0);
Out.color.x = satgray + saturation * color.x;
Out.color.y = satgray + saturation * color.y;
Out.color.z = satgray + saturation * color.z;
Out.color.w = 1.0f;
}
void main(){
Engine* engine = new Engine();
// Инициализация
engine->init(800,600);
// Создаем мир
World* world = engine->createWorld();
Camera* camera = engine->createCamera();
camera->setLocalPosition(float3(0.0,0.0,-4));
Texture* colorMap = engine->loadTexture("color_map.dds");
Texture* normalMap = engine->loadTexture("normal_map.dds");
Material* material = new Material();
material->setTexture( 0 , colorMap );
material->setTexture( 1 , normalMap );
material->setShader( engine->loadShader("mesh_vertex.cg","mesh_textured_bump_pixel.cg",0) );
Mesh* cube = MeshUtil::getInstance().createCube();//createCube(material);
cube->paint(material);
cube->updateTangents();
cube->updateBounds();
//cube->scaleMesh( float3(1,0.1f,1) );
cube->setLocalPosition(float3(0,0,5));
cube->setLocalRotation(rotation(float3(0,0,0)*DEG2RAD));
// Создаем всё для пост фильтера
FrameBuffer* buffer = engine->createBuffer(800,600,FrameBuffer::COLOR0);
Material* postmaterial = new Material();
postmaterial->setDepthWrite(false);
postmaterial->setDepthTest(false,0);
postmaterial->setCullFace(false);
postmaterial->setAlphaBlend(false);
postmaterial->setAlphaTest(false,0);
postmaterial->setTexture(0,buffer->getColorTarget(0));
postmaterial->setShader( engine->loadShader("post_quad_vertex.cg","post_disaturation_pixel.cg",0) );
// OpenAL менеджер
OpenAL* al = engine->getAL();
// Грузим звук
Sound* sound = al->createSound("industrial2.mp3",Sound::STREAM||Sound::LOOP);
// Добавляем в список проигрываемых
sound->play();
while( !engine->keyHit(OIS::KC_ESCAPE) ){
if( engine->keyHit(OIS::KC_F5) )
engine->makeScreenshoot();
// устанавливаем рендер в буффер
engine->setFrameBuffer( buffer);
// очистка буффера цвета\глубины\стенцила
engine->clear(Engine::CLEAR_COLOR|Engine::CLEAR_DEPTH,float4(0,0.2f,0.3f,1.0f),1.0f,0);
cube->turn(float3(.5f,.5f,.5f));
// рисуем мир
engine->updateWorld(0.0f);
engine->renderWorld(0.0f);
// устанавливаем рендер в бек буффер
engine->setFrameBuffer(0);
engine->clear(Engine::CLEAR_COLOR|Engine::CLEAR_DEPTH,float4(0,0.2f,0.3f,1.0f),1.0f,0);
// рисуем квад
postmaterial->bind();
PostQuad::getInstance().render();
postmaterial->unbind();
// Вывод на экран
engine->flip();
}
// заверщение работы движка
engine->exit();
}
Движок кст держит Geometry Shader, планирую сделать адаптивную тессиляцию.
Также забыл сказать,есть потдержка мультисеймплов и сжатие данных( архивы ).