Updated headers with last changes
This commit is contained in:
parent
2b5bdc0324
commit
e32f2e751b
|
|
@ -94,7 +94,7 @@ int main()
|
||||||
|
|
||||||
// Send to material PBR shader camera view position
|
// Send to material PBR shader camera view position
|
||||||
float cameraPos[3] = { camera.position.x, camera.position.y, camera.position.z };
|
float cameraPos[3] = { camera.position.x, camera.position.y, camera.position.z };
|
||||||
SetShaderValue(model.material.shader, model.material.shader.locs[LOC_MATRIX_VIEW], cameraPos, 3);
|
SetShaderValue(model.material.shader, model.material.shader.locs[LOC_VECTOR_VIEW], cameraPos, 3);
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
|
|
|
||||||
|
|
@ -34,13 +34,13 @@ int main()
|
||||||
SetShaderValuei(skybox.material.shader, GetShaderLocation(skybox.material.shader, "environmentMap"), (int[1]){ TEXMAP_CUBEMAP }, 1);
|
SetShaderValuei(skybox.material.shader, GetShaderLocation(skybox.material.shader, "environmentMap"), (int[1]){ TEXMAP_CUBEMAP }, 1);
|
||||||
|
|
||||||
// Get skybox shader locations
|
// Get skybox shader locations
|
||||||
int skyProjectionLoc = GetShaderLocation(skybox.material.shader, "projection");
|
skybox.material.shader.locs[LOC_MATRIX_PROJECTION] = GetShaderLocation(skybox.material.shader, "projection");
|
||||||
skybox.material.shader.locs[LOC_MATRIX_VIEW] = GetShaderLocation(skybox.material.shader, "view");
|
skybox.material.shader.locs[LOC_MATRIX_VIEW] = GetShaderLocation(skybox.material.shader, "view");
|
||||||
|
|
||||||
// Then before rendering, configure the viewport to the actual screen dimensions
|
// Then before rendering, configure the viewport to the actual screen dimensions
|
||||||
Matrix proj = MatrixPerspective(60.0, (double)GetScreenWidth()/(double)GetScreenHeight(), 0.01, 1000.0);
|
Matrix proj = MatrixPerspective(60.0, (double)GetScreenWidth()/(double)GetScreenHeight(), 0.01, 1000.0);
|
||||||
MatrixTranspose(&proj);
|
MatrixTranspose(&proj);
|
||||||
SetShaderValueMatrix(skybox.material.shader, skyProjectionLoc, proj);
|
SetShaderValueMatrix(skybox.material.shader, skybox.material.shader.locs[LOC_MATRIX_PROJECTION], proj);
|
||||||
|
|
||||||
SetCameraMode(camera, CAMERA_ORBITAL); // Set an orbital camera mode
|
SetCameraMode(camera, CAMERA_ORBITAL); // Set an orbital camera mode
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1319,7 +1319,8 @@ Material LoadMaterialPBR(Texture2D hdr, Color albedo, float metalness, float rou
|
||||||
mat.shader.locs[LOC_TEXMAP_BRDF] = GetShaderLocation(mat.shader, "brdfLUT");
|
mat.shader.locs[LOC_TEXMAP_BRDF] = GetShaderLocation(mat.shader, "brdfLUT");
|
||||||
|
|
||||||
// Set view matrix location
|
// Set view matrix location
|
||||||
mat.shader.locs[LOC_MATRIX_VIEW] = GetShaderLocation(mat.shader, "viewPos");
|
mat.shader.locs[LOC_MATRIX_VIEW] = GetShaderLocation(mat.shader, "view");
|
||||||
|
mat.shader.locs[LOC_VECTOR_VIEW] = GetShaderLocation(mat.shader, "viewPos");
|
||||||
|
|
||||||
// Set up material properties color
|
// Set up material properties color
|
||||||
mat.maps[TEXMAP_ALBEDO].color = albedo;
|
mat.maps[TEXMAP_ALBEDO].color = albedo;
|
||||||
|
|
|
||||||
|
|
@ -536,6 +536,7 @@ typedef enum {
|
||||||
LOC_MATRIX_MVP,
|
LOC_MATRIX_MVP,
|
||||||
LOC_MATRIX_VIEW,
|
LOC_MATRIX_VIEW,
|
||||||
LOC_MATRIX_PROJECTION,
|
LOC_MATRIX_PROJECTION,
|
||||||
|
LOC_VECTOR_VIEW,
|
||||||
LOC_COLOR_DIFFUSE,
|
LOC_COLOR_DIFFUSE,
|
||||||
LOC_COLOR_SPECULAR,
|
LOC_COLOR_SPECULAR,
|
||||||
LOC_COLOR_AMBIENT,
|
LOC_COLOR_AMBIENT,
|
||||||
|
|
@ -1027,7 +1028,7 @@ RLAPI void UnloadShader(Shader shader); // Unl
|
||||||
RLAPI Shader GetShaderDefault(void); // Get default shader
|
RLAPI Shader GetShaderDefault(void); // Get default shader
|
||||||
RLAPI Texture2D GetTextureDefault(void); // Get default texture
|
RLAPI Texture2D GetTextureDefault(void); // Get default texture
|
||||||
|
|
||||||
RLAPI Texture2D rlGenMapCubemap(Texture2D skyHDR, int size);
|
RLAPI Texture2D rlGenMapCubemap(Texture2D skyHDR, int size); // Generate cubemap texture map from HDR texture
|
||||||
|
|
||||||
// Shader configuration functions
|
// Shader configuration functions
|
||||||
RLAPI int GetShaderLocation(Shader shader, const char *uniformName); // Get shader uniform location
|
RLAPI int GetShaderLocation(Shader shader, const char *uniformName); // Get shader uniform location
|
||||||
|
|
|
||||||
58
src/rlgl.h
58
src/rlgl.h
|
|
@ -150,46 +150,48 @@ typedef unsigned char byte;
|
||||||
LOC_VERTEX_POSITION = 0,
|
LOC_VERTEX_POSITION = 0,
|
||||||
LOC_VERTEX_TEXCOORD01,
|
LOC_VERTEX_TEXCOORD01,
|
||||||
LOC_VERTEX_TEXCOORD02,
|
LOC_VERTEX_TEXCOORD02,
|
||||||
LOC_VERTEX_TEXCOORD03,
|
|
||||||
LOC_VERTEX_TEXCOORD04,
|
|
||||||
LOC_VERTEX_NORMAL,
|
LOC_VERTEX_NORMAL,
|
||||||
LOC_VERTEX_TANGENT,
|
LOC_VERTEX_TANGENT,
|
||||||
LOC_VERTEX_COLOR,
|
LOC_VERTEX_COLOR,
|
||||||
LOC_MATRIX_MVP,
|
LOC_MATRIX_MVP,
|
||||||
LOC_MATRIX_VIEW,
|
LOC_MATRIX_VIEW,
|
||||||
LOC_MATRIX_PROJECTION,
|
LOC_MATRIX_PROJECTION,
|
||||||
LOC_TEXTURE_MAP01,
|
LOC_VECTOR_VIEW,
|
||||||
LOC_TEXTURE_MAP02,
|
LOC_COLOR_DIFFUSE,
|
||||||
LOC_TEXTURE_MAP03,
|
LOC_COLOR_SPECULAR,
|
||||||
LOC_TEXTURE_MAP04,
|
LOC_COLOR_AMBIENT,
|
||||||
LOC_TEXTURE_MAP05,
|
LOC_TEXMAP_ALBEDO, // LOC_TEXMAP_DIFFUSE
|
||||||
LOC_TEXTURE_MAP06,
|
LOC_TEXMAP_METALNESS, // LOC_TEXMAP_SPECULAR
|
||||||
LOC_TEXTURE_MAP07,
|
LOC_TEXMAP_NORMAL,
|
||||||
LOC_TEXTURE_MAP08,
|
LOC_TEXMAP_ROUGHNESS,
|
||||||
LOC_TEXTURE_COLOR01,
|
LOC_TEXMAP_OCCUSION,
|
||||||
LOC_TEXTURE_COLOR02,
|
LOC_TEXMAP_EMISSION,
|
||||||
LOC_TEXTURE_COLOR03,
|
LOC_TEXMAP_HEIGHT,
|
||||||
LOC_TEXTURE_COLOR04,
|
LOC_TEXMAP_CUBEMAP,
|
||||||
LOC_TEXTURE_COLOR05,
|
LOC_TEXMAP_IRRADIANCE,
|
||||||
LOC_TEXTURE_COLOR06,
|
LOC_TEXMAP_PREFILTER,
|
||||||
LOC_TEXTURE_COLOR07,
|
LOC_TEXMAP_BRDF
|
||||||
LOC_TEXTURE_COLOR08
|
|
||||||
} ShaderLocationIndex;
|
} ShaderLocationIndex;
|
||||||
|
|
||||||
typedef enum {
|
#define LOC_TEXMAP_DIFFUSE LOC_TEXMAP_ALBEDO
|
||||||
TEXMAP_DIFFUSE = 0,
|
#define LOC_TEXMAP_SPECULAR LOC_TEXMAP_METALNESS
|
||||||
TEXMAP_SPECULAR = 1,
|
|
||||||
TEXMAP_NORMAL = 2,
|
|
||||||
} TexmapBasicIndex;
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
TEXMAP_ALBEDO = 0,
|
TEXMAP_ALBEDO = 0, // TEXMAP_DIFFUSE
|
||||||
TEXMAP_METALNESS = 1,
|
TEXMAP_METALNESS = 1, // TEXMAP_SPECULAR
|
||||||
|
TEXMAP_NORMAL = 2,
|
||||||
TEXMAP_ROUGHNESS = 3,
|
TEXMAP_ROUGHNESS = 3,
|
||||||
TEXMAP_OCCLUSION,
|
TEXMAP_OCCLUSION,
|
||||||
TEXMAP_EMISSION,
|
TEXMAP_EMISSION,
|
||||||
TEXMAP_HEIGHT
|
TEXMAP_HEIGHT,
|
||||||
} TexmapPBRIndex;
|
TEXMAP_CUBEMAP, // NOTE: Uses GL_TEXTURE_CUBE_MAP
|
||||||
|
TEXMAP_IRRADIANCE, // NOTE: Uses GL_TEXTURE_CUBE_MAP
|
||||||
|
TEXMAP_PREFILTER, // NOTE: Uses GL_TEXTURE_CUBE_MAP
|
||||||
|
TEXMAP_BRDF
|
||||||
|
} TexmapIndex;
|
||||||
|
|
||||||
|
#define TEXMAP_DIFFUSE TEXMAP_ALBEDO
|
||||||
|
#define TEXMAP_SPECULAR TEXMAP_METALNESS
|
||||||
|
|
||||||
// Color type, RGBA (32bit)
|
// Color type, RGBA (32bit)
|
||||||
typedef struct Color {
|
typedef struct Color {
|
||||||
|
|
@ -417,7 +419,7 @@ void rlDrawMesh(Mesh mesh, Material material, Matrix transform); // Draw a 3d
|
||||||
void rlUnloadMesh(Mesh *mesh); // Unload mesh data from CPU and GPU
|
void rlUnloadMesh(Mesh *mesh); // Unload mesh data from CPU and GPU
|
||||||
|
|
||||||
// Texture maps generation (PBR)
|
// Texture maps generation (PBR)
|
||||||
Texture2D rlGenMapCubemap(Texture2D skyHDR, int size); // Generate cubemap texture map`from HDR texture
|
Texture2D rlGenMapCubemap(Texture2D skyHDR, int size); // Generate cubemap texture map from HDR texture
|
||||||
Texture2D rlGenMapIrradiance(Texture2D cubemap, int size); // Generate irradiance texture map
|
Texture2D rlGenMapIrradiance(Texture2D cubemap, int size); // Generate irradiance texture map
|
||||||
Texture2D rlGenMapPrefilter(Texture2D cubemap, int size); // Generate prefilter texture map
|
Texture2D rlGenMapPrefilter(Texture2D cubemap, int size); // Generate prefilter texture map
|
||||||
Texture2D rlGenMapBRDF(Texture2D cubemap, int size); // Generate BRDF texture map
|
Texture2D rlGenMapBRDF(Texture2D cubemap, int size); // Generate BRDF texture map
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user