This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#version 330 | |
// Input from program: vertex, texture coordinates, | |
// and color. | |
// | |
// In IronClad, these are part of a vertex2_t struct | |
// that is passed to the VBO after being loaded with | |
// mesh data. | |
smooth in vec2 vs_vertex; | |
smooth in vec2 vs_texc; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void CScene::Render() | |
{ | |
// Model-view identity matrix, to be loaded later. | |
static math::matrix4x4_t MVMatrix = math::IDENTITY; | |
// Offload vertex data onto the GPU if it has not been done yet. | |
if(!m_GeometryVBO.Finalized()) m_GeometryVBO.FinalizeBuffer(); | |
// Bind VBO that contains the mesh vertex data. | |
m_GeometryVBO.Bind(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void CScene::Render() | |
// Model-view matrix. | |
static math::matrix4x4_t MVMatrix = math::IDENTITY; | |
// Offload vertex data onto the GPU if it has not been done yet. | |
if(!m_GeometryVBO.Finalized()) m_GeometryVBO.FinalizeBuffer(); | |
// Bind VBO that contains the mesh vertex data. | |
m_GeometryVBO.Bind(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// IronClad vertex buffer object wrapper. | |
#include "VertexBuffer.hpp" | |
// IronClad custom mesh loader. | |
#include "Mesh.hpp" | |
class CMeshInstance | |
{ | |
public: | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define MAX_LIGHTS 10 // Re-written on the fly | |
/** | |
* @file | |
* Fragment shader for lighting. | |
* Per-pixel point light lighting is done in this shader. | |
* | |
* @author me | |
* @addtogroup Shaders | |
* @{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void RenderShadows(const math::CVector2& LightPos), | |
const std::vector<Object*>& shadowCastingObjects) | |
{ | |
// Set up rendering modes | |
glMatrixMode(GL_MODELVIEW); | |
glPushMatrix(); | |
glLoadIdentity(); | |
glDisable(GL_BLEND); | |
glColor4f(0.3f, 0.3f, 0.3f, 1.0f); // Dark gray |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void RenderShadows(const math::CVector2& LightPos), | |
const std::vector<Object*>& shadowCastingObjects) | |
{ | |
// Set up rendering modes | |
glMatrixMode(GL_MODELVIEW); | |
glPushMatrix(); | |
glLoadIdentity(); | |
glDisable(GL_BLEND); | |
glColor4f(0.3f, 0.3f, 0.3f, 1.0f); // Dark gray |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Checks for intersection with another line segment. Touching at | |
* endpoints qualifies as intersections. | |
* | |
* @param math::CRay2 The other line | |
* | |
* @return TRUE if they intersect, FALSE otherwise. | |
* @see http://gamedev.stackexchange.com/questions/26004/how-to-detect-2d-line-on-line-collision | |
**/ | |
bool CRay2::CheckCollision(const CRay2& Other, math::CVector2* p_Intersection) const |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @file | |
* Fragment shader for lighting. | |
* Per-pixel point light lighting is done in this shader. | |
* | |
* @author George Kudrayvtsev (switch1440) | |
* @version 1.0 | |
* @copyright Apache License v2.0 | |
* Licensed under the Apache License, Version 2.0 (the "License").\n | |
* You may not use this file except in compliance with the License.\n |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @file | |
* Fragment shader for lighting. | |
* Per-pixel point light lighting is done in this shader. | |
* | |
* @author George Kudrayvtsev (switch1440) | |
* @version 1.0 | |
* @copyright Apache License v2.0 | |
* Licensed under the Apache License, Version 2.0 (the "License").\n | |
* You may not use this file except in compliance with the License.\n |