Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
mrbid committed Nov 16, 2022
1 parent e817d6d commit fd03aae
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions esAux2.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ const GLchar* v1 =
"{\n"
"vec4 vertPos4 = modelview * position;\n"
"vertPos = vec3(vertPos4) / vertPos4.w;\n"
"vertNorm = vec3(modelview * vec4(position.xyz, 0.0));\n"
"vertNorm = vec3(modelview * vec4(normalize(position.xyz), 0.0));\n"
"vertCol = color;\n"
"vertOpa = opacity;\n"
"vlightPos = lightpos;\n"
Expand Down Expand Up @@ -308,7 +308,7 @@ const GLchar* v13 =
"{\n"
"vec4 vertPos4 = modelview * position;\n"
"vertPos = vec3(vertPos4) / vertPos4.w;\n"
"vertNorm = vec3(modelview * vec4(position.xyz, 0.0));\n"
"vertNorm = vec3(modelview * vec4(normalize(position.xyz), 0.0));\n"
"vertCol = color;\n"
"vertOpa = opacity;\n"
"vlightPos = lightpos;\n"
Expand Down Expand Up @@ -343,21 +343,21 @@ const GLchar* v2 =
"uniform float opacity;\n"
"uniform vec3 lightpos;\n"
"uniform vec3 color;\n"
"attribute vec4 position;\n"
"attribute vec3 position;\n"
"varying vec3 normalInterp;\n"
"varying vec3 vertPos;\n"
"varying vec3 vertCol;\n"
"varying float vertOpa;\n"
"varying vec3 vlightPos;\n"
"void main()\n"
"{\n"
"vec4 vertPos4 = modelview * position;\n"
"vec4 vertPos4 = modelview * vec4(position, 1.0);\n"
"vertPos = vec3(vertPos4) / vertPos4.w;\n"
"vertCol = color;\n"
"vertOpa = opacity;\n"
"vlightPos = lightpos;\n"
"normalInterp = vec3(normalmat * vec4(position.xyz, 0.0));\n"
"gl_Position = projection * modelview * position;\n"
"normalInterp = vec3(normalmat * vec4(normalize(position.xyz), 0.0));\n"
"gl_Position = projection * modelview * vec4(position, 1.0);\n"
"}\n";

const GLchar* v21 =
Expand Down Expand Up @@ -407,12 +407,12 @@ const GLchar* v22 =
"vertCol = color;\n"
"vertOpa = opacity;\n"
"vlightPos = lightpos;\n"
"normalInterp = vec3(normalmat * vec4(position.xyz, 0.0));\n"
"normalInterp = vec3(normalmat * vec4(normalize(position.xyz), 0.0));\n"
"gl_Position = projection * modelview * position;\n"
"}\n";

const GLchar* v23 =
"#version 100\n"
"#version 100\n"
"uniform mat4 modelview;\n"
"uniform mat4 projection;\n"
"uniform mat4 normalmat;\n"
Expand Down Expand Up @@ -652,7 +652,7 @@ void makeLambert1()
void makeLambert2()
{
GLuint vertexShader = glCreateShader(GL_VERTEX_SHADER);
glShaderSource(vertexShader, 1, &v1, NULL);
glShaderSource(vertexShader, 1, &v13, NULL);
glCompileShader(vertexShader);

GLuint fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);
Expand Down
4 changes: 2 additions & 2 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ ESModel mdlCube;
#define NEWGAME_SEED 1337
#define FAR_DISTANCE 512.f

#define ARRAY_MAX 32
#define ARRAY_MAX 64
typedef struct
{
uint health;
Expand Down Expand Up @@ -330,7 +330,7 @@ void rCube(f32 x, f32 y, f32 z, f32 lightness, uint light_mode, f32 r, f32 g, f3
void rndCube(uint i, f32 far)
{
array_cube[i].health = 1;
array_cube[i].pos = (vec){(1 + esRand(0, 15)) * 2, (1 + esRand(0, 9)) * 2, far, 1.f + randf()*9.f};
array_cube[i].pos = (vec){(1 + esRand(0, 14)) * 2, (1 + esRand(0, 8)) * 2, far, 1.f + randf()*9.f};
array_cube[i].r = randf();
array_cube[i].g = randf();
array_cube[i].b = randf();
Expand Down

0 comments on commit fd03aae

Please sign in to comment.