Changed size of textures and file name changed

Changed size of textures from 2048x2048 to 1024x1024 and file name changed to shaders_basic_pbr.c ,
Added the function PBRModel PBRModelLoadFromMesh(Mesh mesh);
but GenMeshPlane(2, 2.0, 3, 3) culdn't be used because it crash once GenMeshTangents() is used with that plane mesh
This commit is contained in:
devdad 2023-12-14 00:05:32 +01:00
parent 213f9f06f8
commit 5eead42e2a
9 changed files with 9 additions and 2 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 MiB

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 MiB

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 MiB

After

Width:  |  Height:  |  Size: 623 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 MiB

After

Width:  |  Height:  |  Size: 657 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 MiB

After

Width:  |  Height:  |  Size: 645 KiB

View File

@ -173,8 +173,10 @@ void PBRLightUpdate(Shader shader, PBRLight light);
void PBRSetAmbient(Shader shader, Color color, float intensity); void PBRSetAmbient(Shader shader, Color color, float intensity);
PBRModel PBRModelLoad(const char *fileName); PBRModel PBRModelLoad(const char *fileName);
PBRModel PBRModelLoadFromMesh(Mesh mesh);
void PBRLoadTextures(PBRMaterial *pbrMat,PBRTexType pbrTexType,const char *fileName); void PBRLoadTextures(PBRMaterial *pbrMat,PBRTexType pbrTexType,const char *fileName);
void UnloadPBRMaterial(PBRMaterial pbrMat) void UnloadPBRMaterial(PBRMaterial pbrMat);
void PBRSetColor(PBRMaterial *pbrMat,PBRColorType pbrColorType,Color color); void PBRSetColor(PBRMaterial *pbrMat,PBRColorType pbrColorType,Color color);
void PBRSetVec2(PBRMaterial *pbrMat,PBRVec2Type type,Vector2 value); void PBRSetVec2(PBRMaterial *pbrMat,PBRVec2Type type,Vector2 value);
void PBRSetFloat(PBRMaterial *pbrMat, PBRFloatType pbrParamType, float value); void PBRSetFloat(PBRMaterial *pbrMat, PBRFloatType pbrParamType, float value);
@ -312,7 +314,6 @@ void PBRMaterialSetup(PBRMaterial *pbrMat, Shader pbrShader, PBREnvironment* env
SetShaderValue(pbrMat->pbrShader,pbrMat->texOffsetLoc,pbrMat->texOffset,SHADER_UNIFORM_VEC2); SetShaderValue(pbrMat->pbrShader,pbrMat->texOffsetLoc,pbrMat->texOffset,SHADER_UNIFORM_VEC2);
} }
void PBRLoadTextures(PBRMaterial *pbrMat,PBRTexType pbrTexType,const char *fileName){ void PBRLoadTextures(PBRMaterial *pbrMat,PBRTexType pbrTexType,const char *fileName){
if(pbrMat == NULL) return; if(pbrMat == NULL) return;
switch(pbrTexType){ switch(pbrTexType){
@ -457,4 +458,9 @@ PBRModel PBRModelLoad(const char *fileName){
return pbrModel; return pbrModel;
} }
PBRModel PBRModelLoadFromMesh(Mesh mesh){
PBRModel pbrModel = (PBRModel){0};
pbrModel.model = LoadModelFromMesh(mesh);
return pbrModel;
}
#endif // RPBR_IMPLEMENTATION #endif // RPBR_IMPLEMENTATION

View File

@ -72,6 +72,7 @@ int main()
PBRSetMaterial(&model,&model_mat,0); PBRSetMaterial(&model,&model_mat,0);
PBRModel floor = PBRModelLoad("resources/models/plane.glb"); PBRModel floor = PBRModelLoad("resources/models/plane.glb");
PBRMaterial floor_mat = (PBRMaterial){0}; PBRMaterial floor_mat = (PBRMaterial){0};
PBRMaterialSetup(&floor_mat, shader, NULL); PBRMaterialSetup(&floor_mat, shader, NULL);
PBRLoadTextures(&floor_mat, PBR_TEXTURE_ALBEDO, "resources/road_a.png"); PBRLoadTextures(&floor_mat, PBR_TEXTURE_ALBEDO, "resources/road_a.png");