commit x64 compilation from lulu cause the other branch dont seems to compile properly at home
This commit is contained in:
48
include/engine/gpu/gpu_skybox.cpp
Normal file
48
include/engine/gpu/gpu_skybox.cpp
Normal file
@ -0,0 +1,48 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
GSFramework
|
||||
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
|
||||
----------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
#include "gpu/gpu_renderer.h"
|
||||
#include "core/camera.h"
|
||||
|
||||
using namespace GS::GPU;
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void Renderer::DrawSkybox(GS::Render::sTexture t[2], GS::Render::Shader *s)
|
||||
{
|
||||
static const size_t stride = sizeof(float) * 3;
|
||||
|
||||
SetDepthFunc(DepthEqual); // only draw on Z = 1
|
||||
EnableDepthWrite(false);
|
||||
|
||||
Shader &p = s ? (Shader &)*s : *skybox_program;
|
||||
|
||||
SetShaderProgram(&p);
|
||||
SetIndexSource(skybox_idx_vbo);
|
||||
SetVertexSource(skybox_vtx_vbo, stride);
|
||||
|
||||
ShaderInput *vtx_parm = p.GetInput(Core::ShaderInput::Position),
|
||||
*layer0_parm = p.GetInput("u_layer0"),
|
||||
*layer1_parm = p.GetInput("u_layer1");
|
||||
|
||||
p.Set(*vtx_parm->location, 3, Types::ValueFloat, false, stride, (const void *)0);
|
||||
if (layer0_parm && t[0].IsValid())
|
||||
p.Set(*layer0_parm->location, (Render::Texture &)*t[0], layer0_parm->index);
|
||||
if (layer1_parm && t[1].IsValid())
|
||||
p.Set(*layer1_parm->location, (Render::Texture &)*t[1], layer1_parm->index);
|
||||
|
||||
p.SetRendererInputs(*this);
|
||||
p.SetTransformInputs(m_projection, m_view, m_iview, &Matrix4::IdentityMatrix(), &Matrix4::IdentityMatrix());
|
||||
p.CommitInputs();
|
||||
|
||||
DrawElements(Types::PrimitiveTriangle, 3 * 2, Types::ValueUShort);
|
||||
|
||||
p.Set(*vtx_parm->location, 0, Types::ValueLast, false, 0, NULL);
|
||||
|
||||
EnableDepthWrite(true);
|
||||
SetDepthFunc(DepthLess);
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
Reference in New Issue
Block a user