Skip to content

Commit

Permalink
Maybe fix shaders
Browse files Browse the repository at this point in the history
  • Loading branch information
Alphalaneous committed Jul 25, 2024
1 parent bec80b9 commit 2e022ae
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
10 changes: 2 additions & 8 deletions assets/shaders/cubemap/cubemap_frag.glsl
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#version 130

uniform vec2 center;
uniform vec2 resolution;
uniform float time;
Expand All @@ -9,11 +7,10 @@ uniform samplerCube skybox;

void main(){


float rotX = (time / resolution.x) * -20.0 * 3.14;
float rotY = (resolution.y/2 / resolution.y) * 3.14;
float rotY = (resolution.y / 2.0 / resolution.y) * 3.14;

vec2 uv = 4 * (gl_FragCoord.xy - 0.5 * resolution.xy) / resolution.xx;
vec2 uv = 4.0 * (gl_FragCoord.xy - 0.5 * resolution.xy) / resolution.xx;

vec3 camO = vec3(cos(rotX), cos(rotY), sin(rotX));

Expand All @@ -25,9 +22,6 @@ void main(){

vec3 dir = normalize(-uv.x * camR + uv.y * camU + camD);




gl_FragColor = texture(skybox, dir);

}
2 changes: 0 additions & 2 deletions assets/shaders/cubemap/cubemap_vert.glsl
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#version 130

attribute vec4 aPosition;

void main() {
Expand Down
1 change: 0 additions & 1 deletion src/ui/nodes/Panorama.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ bool Panorama::init(){
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_CUBE_MAP, 0x8072, GL_CLAMP_TO_EDGE);

auto glv = CCDirector::sharedDirector()->getOpenGLView();
auto winSize = CCDirector::sharedDirector()->getWinSize();
Expand Down
12 changes: 12 additions & 0 deletions src/utils/Shader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ void Shader::setup(std::string vertexSource, std::string fragmentSource){

vertex = glCreateShader(GL_VERTEX_SHADER);
const char* vertexSources[] = {
#ifdef GEODE_IS_WINDOWS
"#version 130\n",
#endif
#ifdef GEODE_IS_MOBILE
"precision highp float;\n",
#endif
vertexSource.c_str()
};

Expand All @@ -21,6 +27,12 @@ void Shader::setup(std::string vertexSource, std::string fragmentSource){

fragment = glCreateShader(GL_FRAGMENT_SHADER);
const char* fragmentSources[] = {
#ifdef GEODE_IS_WINDOWS
"#version 130\n",
#endif
#ifdef GEODE_IS_MOBILE
"precision highp float;\n",
#endif
fragmentSource.c_str()
};

Expand Down

0 comments on commit 2e022ae

Please sign in to comment.