Review text formatting (spacing, tabs...)

This commit is contained in:
raysan5 2016-05-31 19:12:37 +02:00
parent 302ec438dd
commit d17a0cee1a
7 changed files with 116 additions and 113 deletions

View file

@ -88,8 +88,10 @@ vec3 CalcSpotLight(Light l, vec3 n, vec3 v, float s)
// Spot attenuation // Spot attenuation
float attenuation = clamp(dot(n, lightToSurface), 0.0, 1.0); float attenuation = clamp(dot(n, lightToSurface), 0.0, 1.0);
attenuation = dot(lightToSurface, -lightDir); attenuation = dot(lightToSurface, -lightDir);
float lightToSurfaceAngle = degrees(acos(attenuation)); float lightToSurfaceAngle = degrees(acos(attenuation));
if (lightToSurfaceAngle > l.coneAngle) attenuation = 0.0; if (lightToSurfaceAngle > l.coneAngle) attenuation = 0.0;
float falloff = (l.coneAngle - lightToSurfaceAngle)/l.coneAngle; float falloff = (l.coneAngle - lightToSurfaceAngle)/l.coneAngle;
// Combine diffuse and attenuation // Combine diffuse and attenuation
@ -103,7 +105,7 @@ vec3 CalcSpotLight(Light l, vec3 n, vec3 v, float s)
spec = pow(dot(n, h), 3 + glossiness)*s; spec = pow(dot(n, h), 3 + glossiness)*s;
} }
return falloff*(diffAttenuation*l.diffuse.rgb + spec*colSpecular.rgb); return (falloff*(diffAttenuation*l.diffuse.rgb + spec*colSpecular.rgb));
} }
void main() void main()

View file

@ -349,7 +349,7 @@ typedef struct Camera {
Vector3 position; // Camera position Vector3 position; // Camera position
Vector3 target; // Camera target it looks-at Vector3 target; // Camera target it looks-at
Vector3 up; // Camera up vector (rotation over its axis) Vector3 up; // Camera up vector (rotation over its axis)
float fovy; // Field-Of-View apperture in Y (degrees) float fovy; // Camera field-of-view apperture in Y (degrees)
} Camera; } Camera;
// Camera2D type, defines a 2d camera // Camera2D type, defines a 2d camera
@ -362,8 +362,8 @@ typedef struct Camera2D {
// Bounding box type // Bounding box type
typedef struct BoundingBox { typedef struct BoundingBox {
Vector3 min; Vector3 min; // minimum vertex box-corner
Vector3 max; Vector3 max; // maximum vertex box-corner
} BoundingBox; } BoundingBox;
// Vertex data definning a mesh // Vertex data definning a mesh
@ -378,8 +378,6 @@ typedef struct Mesh {
unsigned char *colors; // vertex colors (RGBA - 4 components per vertex) (shader-location = 3) unsigned char *colors; // vertex colors (RGBA - 4 components per vertex) (shader-location = 3)
unsigned short *indices;// vertex indices (in case vertex data comes indexed) unsigned short *indices;// vertex indices (in case vertex data comes indexed)
BoundingBox bounds; // mesh limits defined by min and max points
unsigned int vaoId; // OpenGL Vertex Array Object id unsigned int vaoId; // OpenGL Vertex Array Object id
unsigned int vboId[7]; // OpenGL Vertex Buffer Objects id (7 types of vertex data) unsigned int vboId[7]; // OpenGL Vertex Buffer Objects id (7 types of vertex data)
} Mesh; } Mesh;
@ -430,7 +428,7 @@ typedef struct Model {
// Light type // Light type
typedef struct LightData { typedef struct LightData {
unsigned int id; // Light id unsigned int id; // Light unique id
int type; // Light type: LIGHT_POINT, LIGHT_DIRECTIONAL, LIGHT_SPOT int type; // Light type: LIGHT_POINT, LIGHT_DIRECTIONAL, LIGHT_SPOT
bool enabled; // Light enabled bool enabled; // Light enabled

View file

@ -131,15 +131,10 @@ typedef enum { OPENGL_11 = 1, OPENGL_33, OPENGL_ES_20 } GlVersion;
COMPRESSED_ASTC_8x8_RGBA // 2 bpp COMPRESSED_ASTC_8x8_RGBA // 2 bpp
} TextureFormat; } TextureFormat;
// Bounding box type
typedef struct BoundingBox {
Vector3 min;
Vector3 max;
} BoundingBox;
// Vertex data definning a mesh // Vertex data definning a mesh
typedef struct Mesh { typedef struct Mesh {
int vertexCount; // number of vertices stored in arrays int vertexCount; // number of vertices stored in arrays
int triangleCount; // number of triangles stored (indexed or not)
float *vertices; // vertex position (XYZ - 3 components per vertex) (shader-location = 0) float *vertices; // vertex position (XYZ - 3 components per vertex) (shader-location = 0)
float *texcoords; // vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1) float *texcoords; // vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1)
float *texcoords2; // vertex second texture coordinates (useful for lightmaps) (shader-location = 5) float *texcoords2; // vertex second texture coordinates (useful for lightmaps) (shader-location = 5)
@ -147,9 +142,6 @@ typedef enum { OPENGL_11 = 1, OPENGL_33, OPENGL_ES_20 } GlVersion;
float *tangents; // vertex tangents (XYZ - 3 components per vertex) (shader-location = 4) float *tangents; // vertex tangents (XYZ - 3 components per vertex) (shader-location = 4)
unsigned char *colors; // vertex colors (RGBA - 4 components per vertex) (shader-location = 3) unsigned char *colors; // vertex colors (RGBA - 4 components per vertex) (shader-location = 3)
unsigned short *indices;// vertex indices (in case vertex data comes indexed) unsigned short *indices;// vertex indices (in case vertex data comes indexed)
int triangleCount; // number of triangles stored (indexed or not)
BoundingBox bounds; // mesh limits defined by min and max points
unsigned int vaoId; // OpenGL Vertex Array Object id unsigned int vaoId; // OpenGL Vertex Array Object id
unsigned int vboId[7]; // OpenGL Vertex Buffer Objects id (7 types of vertex data) unsigned int vboId[7]; // OpenGL Vertex Buffer Objects id (7 types of vertex data)
@ -209,9 +201,17 @@ typedef enum { OPENGL_11 = 1, OPENGL_33, OPENGL_ES_20 } GlVersion;
float glossiness; // Glossiness level (Ranges from 0 to 1000) float glossiness; // Glossiness level (Ranges from 0 to 1000)
} Material; } Material;
// Camera type, defines a camera position/orientation in 3d space
typedef struct Camera {
Vector3 position; // Camera position
Vector3 target; // Camera target it looks-at
Vector3 up; // Camera up vector (rotation over its axis)
float fovy; // Camera field-of-view apperture in Y (degrees)
} Camera;
// Light type // Light type
typedef struct LightData { typedef struct LightData {
unsigned int id; // Light id unsigned int id; // Light unique id
int type; // Light type: LIGHT_POINT, LIGHT_DIRECTIONAL, LIGHT_SPOT int type; // Light type: LIGHT_POINT, LIGHT_DIRECTIONAL, LIGHT_SPOT
bool enabled; // Light enabled bool enabled; // Light enabled
@ -225,6 +225,9 @@ typedef enum { OPENGL_11 = 1, OPENGL_33, OPENGL_ES_20 } GlVersion;
float coneAngle; // Light cone max angle: LIGHT_SPOT float coneAngle; // Light cone max angle: LIGHT_SPOT
} LightData, *Light; } LightData, *Light;
// Light types
typedef enum { LIGHT_POINT, LIGHT_DIRECTIONAL, LIGHT_SPOT } LightType;
// Color blending modes (pre-defined) // Color blending modes (pre-defined)
typedef enum { BLEND_ALPHA = 0, BLEND_ADDITIVE, BLEND_MULTIPLIED } BlendMode; typedef enum { BLEND_ALPHA = 0, BLEND_ADDITIVE, BLEND_MULTIPLIED } BlendMode;
#endif #endif