forked from Hopson97/HopsonCraft
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
335 additions
and
71 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#version 330 core | ||
out vec4 outColour; | ||
|
||
in vec3 passTexCoords; | ||
|
||
uniform samplerCube skybox; | ||
|
||
void main() | ||
{ | ||
outColour = vec4(1, 1, 0, 1);//texture(skybox, passTexCoords); | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#version 330 core | ||
|
||
layout (location = 0) in vec3 inVertexCoords; | ||
|
||
out vec3 passTexCoords; | ||
|
||
uniform mat4 projection; | ||
uniform mat4 view; | ||
|
||
void main() | ||
{ | ||
passTexCoords = inVertexCoords; | ||
gl_Position = projection * view * vec4(inVertexCoords, 1.0); | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
UPDATED THE 28TH, REMOVED A FUNKY PLANET | ||
|
||
INTERSTELLAR | ||
high res 1024^2 environment map | ||
ships as TGA. | ||
|
||
|
||
By Jockum Skoglund aka hipshot | ||
[email protected] | ||
www.zfight.com | ||
Stockholm, 2005 08 25 | ||
|
||
|
||
Modify however you like, just cred me for my work, maybe link to my page. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
#include "RSkyBox.h" | ||
|
||
#include "../Camera.h" | ||
#include "../Texture/CubeTexture.h" | ||
|
||
#include "../ModelCoords.h" | ||
|
||
#include "../Maths/Matrix.h" | ||
|
||
#include <iostream> | ||
|
||
float skyboxVertices[] = { | ||
// positions | ||
-1.0f, 1.0f, -1.0f, | ||
-1.0f, -1.0f, -1.0f, | ||
1.0f, -1.0f, -1.0f, | ||
1.0f, -1.0f, -1.0f, | ||
1.0f, 1.0f, -1.0f, | ||
-1.0f, 1.0f, -1.0f, | ||
|
||
-1.0f, -1.0f, 1.0f, | ||
-1.0f, -1.0f, -1.0f, | ||
-1.0f, 1.0f, -1.0f, | ||
-1.0f, 1.0f, -1.0f, | ||
-1.0f, 1.0f, 1.0f, | ||
-1.0f, -1.0f, 1.0f, | ||
|
||
1.0f, -1.0f, -1.0f, | ||
1.0f, -1.0f, 1.0f, | ||
1.0f, 1.0f, 1.0f, | ||
1.0f, 1.0f, 1.0f, | ||
1.0f, 1.0f, -1.0f, | ||
1.0f, -1.0f, -1.0f, | ||
|
||
-1.0f, -1.0f, 1.0f, | ||
-1.0f, 1.0f, 1.0f, | ||
1.0f, 1.0f, 1.0f, | ||
1.0f, 1.0f, 1.0f, | ||
1.0f, -1.0f, 1.0f, | ||
-1.0f, -1.0f, 1.0f, | ||
|
||
-1.0f, 1.0f, -1.0f, | ||
1.0f, 1.0f, -1.0f, | ||
1.0f, 1.0f, 1.0f, | ||
1.0f, 1.0f, 1.0f, | ||
-1.0f, 1.0f, 1.0f, | ||
-1.0f, 1.0f, -1.0f, | ||
|
||
-1.0f, -1.0f, -1.0f, | ||
-1.0f, -1.0f, 1.0f, | ||
1.0f, -1.0f, -1.0f, | ||
1.0f, -1.0f, -1.0f, | ||
-1.0f, -1.0f, 1.0f, | ||
1.0f, -1.0f, 1.0f | ||
}; | ||
|
||
GLuint vbo; | ||
|
||
namespace Renderer | ||
{ | ||
SkyBox::SkyBox() | ||
: m_shader("SkyBox", "SkyBox") | ||
//, m_cube (getCubeVerticies(10.0f, 10.0f), getCubeIndices()) | ||
{ | ||
glBindVertexArray(0); | ||
|
||
glGenBuffers(1, &vbo); | ||
glBindBuffer(GL_ARRAY_BUFFER, vbo); | ||
glBufferData(GL_ARRAY_BUFFER, | ||
sizeof(skyboxVertices), | ||
skyboxVertices, | ||
GL_STATIC_DRAW); | ||
|
||
glVertexAttribPointer(0, | ||
3, | ||
GL_FLOAT, | ||
GL_FALSE, | ||
0, | ||
(GLvoid*) 0); | ||
|
||
} | ||
|
||
void SkyBox::draw(const Texture::CubeTexture& cubeTex) | ||
{ | ||
m_pCubeMap = &cubeTex; | ||
} | ||
|
||
void SkyBox::update(const Camera& camera) | ||
{ | ||
if(!m_pCubeMap) return; | ||
|
||
glDepthMask(GL_FALSE); | ||
m_shader .bind(); //shader | ||
//m_cube .bind(); //VAO | ||
m_pCubeMap ->bind(); //texture | ||
|
||
glBindVertexArray(0); | ||
glBindBuffer(GL_ARRAY_BUFFER, vbo); | ||
|
||
const auto& view = camera.getViewMatrix(); | ||
const auto& proj = camera.getProjMatrix(); | ||
|
||
auto sView = Matrix4(glm::mat3(view)); | ||
|
||
m_shader.setProjViewMatrix (proj * sView); | ||
|
||
glDrawArrays(GL_TRIANGLES, 0, 36); | ||
|
||
//glDisable(GL_CULL_FACE); | ||
//glDrawElements(GL_TRIANGLES, m_cube.getIndicesCount(), GL_UNSIGNED_INT, nullptr); | ||
|
||
glDepthMask(GL_TRUE); | ||
m_pCubeMap = nullptr; | ||
} | ||
} |
Oops, something went wrong.