Remove trail spaces
This commit is contained in:
parent
f92ee46d86
commit
dcf52c132f
61 changed files with 565 additions and 565 deletions
|
@ -11,7 +11,7 @@
|
|||
*
|
||||
********************************************************************************************
|
||||
*
|
||||
* To export a model from blender, make sure it is not posed, the vertices need to be in the
|
||||
* To export a model from blender, make sure it is not posed, the vertices need to be in the
|
||||
* same position as they would be in edit mode.
|
||||
* and that the scale of your models is set to 0. Scaling can be done from the export menu.
|
||||
*
|
||||
|
@ -100,7 +100,7 @@ int main(void)
|
|||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
UnloadTexture(texture); // Unload texture
|
||||
|
||||
|
||||
// Unload model animations data
|
||||
for (int i = 0; i < animsCount; i++) UnloadModelAnimation(anims[i]);
|
||||
RL_FREE(anims);
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*
|
||||
********************************************************************************************
|
||||
*
|
||||
* To export a model from blender, make sure it is not posed, the vertices need to be in the
|
||||
* To export a model from blender, make sure it is not posed, the vertices need to be in the
|
||||
* same position as they would be in edit mode.
|
||||
* and that the scale of your models is set to 0. Scaling can be done from the export menu.
|
||||
*
|
||||
|
@ -68,13 +68,13 @@ int main(void)
|
|||
if (IsKeyDown(KEY_SPACE))
|
||||
{
|
||||
animFrameCounter += animationDirection;
|
||||
|
||||
|
||||
if (animFrameCounter >= anims[0].frameCount || animFrameCounter <= 0)
|
||||
{
|
||||
animationDirection *= -1;
|
||||
animFrameCounter += animationDirection;
|
||||
}
|
||||
|
||||
|
||||
UpdateModelAnimation(model, anims[0], animFrameCounter);
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
|
@ -108,7 +108,7 @@ int main(void)
|
|||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
// UnloadTexture(texture); // Unload texture
|
||||
|
||||
|
||||
// Unload model animations data
|
||||
for (int i = 0; i < animsCount; i++) UnloadModelAnimation(anims[i]);
|
||||
RL_FREE(anims);
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*
|
||||
********************************************************************************************
|
||||
*
|
||||
* To export a model from blender, make sure it is not posed, the vertices need to be in the
|
||||
* To export a model from blender, make sure it is not posed, the vertices need to be in the
|
||||
* same position as they would be in edit mode.
|
||||
* and that the scale of your models is set to 0. Scaling can be done from the export menu.
|
||||
*
|
||||
|
@ -41,14 +41,14 @@ int main(void)
|
|||
camera.projection = CAMERA_PERSPECTIVE; // Camera mode type
|
||||
|
||||
Model model[MAX_MODELS] = { 0 };
|
||||
|
||||
|
||||
model[0] = LoadModel("resources/gltf/raylib_32x32.glb");
|
||||
model[1] = LoadModel("resources/gltf/rigged_figure.glb");
|
||||
model[2] = LoadModel("resources/gltf/GearboxAssy.glb");
|
||||
model[3] = LoadModel("resources/gltf/BoxAnimated.glb");
|
||||
model[4] = LoadModel("resources/gltf/AnimatedTriangle.gltf");
|
||||
model[5] = LoadModel("resources/gltf/AnimatedMorphCube.glb");
|
||||
|
||||
|
||||
int currentModel = 0;
|
||||
|
||||
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
|
||||
|
@ -64,13 +64,13 @@ int main(void)
|
|||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
UpdateCamera(&camera);
|
||||
|
||||
|
||||
if (IsKeyReleased(KEY_RIGHT))
|
||||
{
|
||||
currentModel++;
|
||||
if (currentModel == MAX_MODELS) currentModel = 0;
|
||||
}
|
||||
|
||||
|
||||
if (IsKeyReleased(KEY_LEFT))
|
||||
{
|
||||
currentModel--;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
* - GLTF > Modern text/binary file format, includes lot of information and it could
|
||||
* also reference external files, raylib will try loading mesh and materials data
|
||||
* - IQM > Binary file format including mesh vertex data but also animation data,
|
||||
* raylib can load .iqm animations.
|
||||
* raylib can load .iqm animations.
|
||||
*
|
||||
* This example has been created using raylib 2.6 (www.raylib.com)
|
||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||
|
@ -42,7 +42,7 @@ int main(void)
|
|||
model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set map diffuse texture
|
||||
|
||||
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
|
||||
|
||||
|
||||
BoundingBox bounds = MeshBoundingBox(model.meshes[0]); // Set model bounds
|
||||
|
||||
// NOTE: bounds are calculated from the original size of the model,
|
||||
|
@ -61,7 +61,7 @@ int main(void)
|
|||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
UpdateCamera(&camera);
|
||||
|
||||
|
||||
// Load new models/textures on drag&drop
|
||||
if (IsFileDropped())
|
||||
{
|
||||
|
@ -79,7 +79,7 @@ int main(void)
|
|||
model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set current map diffuse texture
|
||||
|
||||
bounds = MeshBoundingBox(model.meshes[0]);
|
||||
|
||||
|
||||
// TODO: Move camera position from target enough distance to visualize model properly
|
||||
}
|
||||
else if (IsFileExtension(droppedFiles[0], ".png")) // Texture file formats supported
|
||||
|
@ -118,7 +118,7 @@ int main(void)
|
|||
if (selected) DrawBoundingBox(bounds, GREEN); // Draw selection box
|
||||
|
||||
EndMode3D();
|
||||
|
||||
|
||||
DrawText("Drag & drop model to load mesh/texture.", 10, GetScreenHeight() - 20, 10, DARKGRAY);
|
||||
if (selected) DrawText("MODEL SELECTED", GetScreenWidth() - 110, 10, 10, GREEN);
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ static Material LoadMaterialPBR(Color albedo, float metalness, float roughness)
|
|||
Material mat = LoadMaterialDefault(); // Initialize material to default
|
||||
|
||||
// Load PBR shader (requires several maps)
|
||||
mat.shader = LoadShader(TextFormat("resources/shaders/glsl%i/pbr.vs", GLSL_VERSION),
|
||||
mat.shader = LoadShader(TextFormat("resources/shaders/glsl%i/pbr.vs", GLSL_VERSION),
|
||||
TextFormat("resources/shaders/glsl%i/pbr.fs", GLSL_VERSION));
|
||||
|
||||
// Get required locations points for PBR material
|
||||
|
@ -160,14 +160,14 @@ static Material LoadMaterialPBR(Color albedo, float metalness, float roughness)
|
|||
mat.maps[MATERIAL_MAP_METALNESS].texture = LoadTexture("resources/pbr/trooper_metalness.png");
|
||||
mat.maps[MATERIAL_MAP_ROUGHNESS].texture = LoadTexture("resources/pbr/trooper_roughness.png");
|
||||
mat.maps[MATERIAL_MAP_OCCLUSION].texture = LoadTexture("resources/pbr/trooper_ao.png");
|
||||
|
||||
|
||||
// Set textures filtering for better quality
|
||||
SetTextureFilter(mat.maps[MATERIAL_MAP_ALBEDO].texture, FILTER_BILINEAR);
|
||||
SetTextureFilter(mat.maps[MATERIAL_MAP_NORMAL].texture, FILTER_BILINEAR);
|
||||
SetTextureFilter(mat.maps[MATERIAL_MAP_METALNESS].texture, FILTER_BILINEAR);
|
||||
SetTextureFilter(mat.maps[MATERIAL_MAP_ROUGHNESS].texture, FILTER_BILINEAR);
|
||||
SetTextureFilter(mat.maps[MATERIAL_MAP_OCCLUSION].texture, FILTER_BILINEAR);
|
||||
|
||||
|
||||
// Enable sample usage in shader for assigned textures
|
||||
SetShaderValue(mat.shader, GetShaderLocation(mat.shader, "albedo.useSampler"), (int[1]){ 1 }, SHADER_UNIFORM_INT);
|
||||
SetShaderValue(mat.shader, GetShaderLocation(mat.shader, "normals.useSampler"), (int[1]){ 1 }, SHADER_UNIFORM_INT);
|
||||
|
@ -186,13 +186,13 @@ static Material LoadMaterialPBR(Color albedo, float metalness, float roughness)
|
|||
mat.maps[MATERIAL_MAP_OCCLUSION].value = 1.0f;
|
||||
mat.maps[MATERIAL_MAP_EMISSION].value = 0.5f;
|
||||
mat.maps[MATERIAL_MAP_HEIGHT].value = 0.5f;
|
||||
|
||||
|
||||
// Generate cubemap from panorama texture
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
Texture2D panorama = LoadTexture("resources/dresden_square_2k.hdr");
|
||||
|
||||
|
||||
// Load equirectangular to cubemap shader
|
||||
Shader shdrCubemap = LoadShader(TextFormat("resources/shaders/glsl%i/pbr.vs", GLSL_VERSION),
|
||||
Shader shdrCubemap = LoadShader(TextFormat("resources/shaders/glsl%i/pbr.vs", GLSL_VERSION),
|
||||
TextFormat("resources/shaders/glsl%i/pbr.fs", GLSL_VERSION));
|
||||
|
||||
SetShaderValue(shdrCubemap, GetShaderLocation(shdrCubemap, "equirectangularMap"), (int[1]){ 0 }, SHADER_UNIFORM_INT);
|
||||
|
@ -200,33 +200,33 @@ static Material LoadMaterialPBR(Color albedo, float metalness, float roughness)
|
|||
UnloadTexture(panorama);
|
||||
UnloadShader(shdrCubemap);
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Generate irradiance map from cubemap texture
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
// Load irradiance (GI) calculation shader
|
||||
Shader shdrIrradiance = LoadShader(TextFormat("resources/shaders/glsl%i/skybox.vs", GLSL_VERSION),
|
||||
Shader shdrIrradiance = LoadShader(TextFormat("resources/shaders/glsl%i/skybox.vs", GLSL_VERSION),
|
||||
TextFormat("resources/shaders/glsl%i/irradiance.fs", GLSL_VERSION));
|
||||
|
||||
SetShaderValue(shdrIrradiance, GetShaderLocation(shdrIrradiance, "environmentMap"), (int[1]){ 0 }, SHADER_UNIFORM_INT);
|
||||
mat.maps[MATERIAL_MAP_IRRADIANCE].texture = GenTextureIrradiance(shdrIrradiance, cubemap, IRRADIANCE_SIZE);
|
||||
UnloadShader(shdrIrradiance);
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Generate prefilter map from cubemap texture
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
// Load reflection prefilter calculation shader
|
||||
Shader shdrPrefilter = LoadShader(TextFormat("resources/shaders/glsl%i/skybox.vs", GLSL_VERSION),
|
||||
Shader shdrPrefilter = LoadShader(TextFormat("resources/shaders/glsl%i/skybox.vs", GLSL_VERSION),
|
||||
TextFormat("resources/shaders/glsl%i/prefilter.fs", GLSL_VERSION));
|
||||
|
||||
|
||||
SetShaderValue(shdrPrefilter, GetShaderLocation(shdrPrefilter, "environmentMap"), (int[1]){ 0 }, SHADER_UNIFORM_INT);
|
||||
mat.maps[MATERIAL_MAP_PREFILTER].texture = GenTexturePrefilter(shdrPrefilter, cubemap, PREFILTERED_SIZE);
|
||||
UnloadTexture(cubemap);
|
||||
UnloadShader(shdrPrefilter);
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Generate BRDF (bidirectional reflectance distribution function) texture (using shader)
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
Shader shdrBRDF = LoadShader(TextFormat("resources/shaders/glsl%i/brdf.vs", GLSL_VERSION),
|
||||
Shader shdrBRDF = LoadShader(TextFormat("resources/shaders/glsl%i/brdf.vs", GLSL_VERSION),
|
||||
TextFormat("resources/shaders/glsl%i/brdf.fs", GLSL_VERSION));
|
||||
|
||||
mat.maps[MATERIAL_MAP_BRDG].texture = GenTextureBRDF(shdrBRDF, BRDF_SIZE);
|
||||
|
@ -453,7 +453,7 @@ static TextureCubemap GenTexturePrefilter(Shader shader, TextureCubemap cubemap,
|
|||
{
|
||||
rlSetUniformMatrix(shader.locs[SHADER_LOC_MATRIX_VIEW], fboViews[i]);
|
||||
rlFramebufferAttach(fbo, prefilter.id, RL_ATTACHMENT_COLOR_CHANNEL0, RL_ATTACHMENT_CUBEMAP_POSITIVE_X + i, mip);
|
||||
|
||||
|
||||
rlClearScreenBuffers();
|
||||
rlLoadDrawCube();
|
||||
}
|
||||
|
|
|
@ -135,7 +135,7 @@ void DrawSphereBasic(Color color)
|
|||
{
|
||||
int rings = 16;
|
||||
int slices = 16;
|
||||
|
||||
|
||||
// Make sure there is enough space in the internal render batch
|
||||
// buffer to store all required vertex, batch is reseted if required
|
||||
rlCheckRenderBatchLimit((rings + 2)*slices*6);
|
||||
|
|
|
@ -36,12 +36,12 @@ int main(void)
|
|||
// Load skybox model
|
||||
Mesh cube = GenMeshCube(1.0f, 1.0f, 1.0f);
|
||||
Model skybox = LoadModelFromMesh(cube);
|
||||
|
||||
|
||||
bool useHDR = false;
|
||||
|
||||
// Load skybox shader and set required locations
|
||||
// NOTE: Some locations are automatically set at shader loading
|
||||
skybox.materials[0].shader = LoadShader(TextFormat("resources/shaders/glsl%i/skybox.vs", GLSL_VERSION),
|
||||
skybox.materials[0].shader = LoadShader(TextFormat("resources/shaders/glsl%i/skybox.vs", GLSL_VERSION),
|
||||
TextFormat("resources/shaders/glsl%i/skybox.fs", GLSL_VERSION));
|
||||
|
||||
SetShaderValue(skybox.materials[0].shader, GetShaderLocation(skybox.materials[0].shader, "environmentMap"), (int[1]){ MATERIAL_MAP_CUBEMAP }, SHADER_UNIFORM_INT);
|
||||
|
@ -49,7 +49,7 @@ int main(void)
|
|||
SetShaderValue(skybox.materials[0].shader, GetShaderLocation(skybox.materials[0].shader, "vflipped"), (int[1]){ useHDR ? 1 : 0 }, SHADER_UNIFORM_INT);
|
||||
|
||||
// Load cubemap shader and setup required shader locations
|
||||
Shader shdrCubemap = LoadShader(TextFormat("resources/shaders/glsl%i/cubemap.vs", GLSL_VERSION),
|
||||
Shader shdrCubemap = LoadShader(TextFormat("resources/shaders/glsl%i/cubemap.vs", GLSL_VERSION),
|
||||
TextFormat("resources/shaders/glsl%i/cubemap.fs", GLSL_VERSION));
|
||||
|
||||
SetShaderValue(shdrCubemap, GetShaderLocation(shdrCubemap, "equirectangularMap"), (int[1]){ 0 }, SHADER_UNIFORM_INT);
|
||||
|
@ -89,7 +89,7 @@ int main(void)
|
|||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
UpdateCamera(&camera); // Update camera
|
||||
|
||||
|
||||
// Load new cubemap texture on drag&drop
|
||||
if (IsFileDropped())
|
||||
{
|
||||
|
@ -105,7 +105,7 @@ int main(void)
|
|||
if (useHDR)
|
||||
{
|
||||
Texture2D panorama = LoadTexture(droppedFiles[0]);
|
||||
|
||||
|
||||
// Generate cubemap from panorama texture
|
||||
skybox.materials[0].maps[MATERIAL_MAP_CUBEMAP].texture = GenTextureCubemap(shdrCubemap, panorama, 1024, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8);
|
||||
UnloadTexture(panorama);
|
||||
|
@ -132,16 +132,16 @@ int main(void)
|
|||
ClearBackground(RAYWHITE);
|
||||
|
||||
BeginMode3D(camera);
|
||||
|
||||
|
||||
// We are inside the cube, we need to disable backface culling!
|
||||
rlDisableBackfaceCulling();
|
||||
rlDisableDepthMask();
|
||||
DrawModel(skybox, (Vector3){0, 0, 0}, 1.0f, WHITE);
|
||||
rlEnableBackfaceCulling();
|
||||
rlEnableDepthMask();
|
||||
|
||||
|
||||
DrawGrid(10, 1.0f);
|
||||
|
||||
|
||||
EndMode3D();
|
||||
|
||||
if (useHDR)
|
||||
|
@ -159,7 +159,7 @@ int main(void)
|
|||
//--------------------------------------------------------------------------------------
|
||||
UnloadShader(skybox.materials[0].shader);
|
||||
UnloadTexture(skybox.materials[0].maps[MATERIAL_MAP_CUBEMAP].texture);
|
||||
|
||||
|
||||
UnloadModel(skybox); // Unload skybox model
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
|
|
|
@ -53,7 +53,7 @@ int main()
|
|||
camera.position.x = (float)cos(cameraTime)*40.0f;
|
||||
camera.position.z = (float)sin(cameraTime)*40.0f;
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
@ -64,11 +64,11 @@ int main()
|
|||
|
||||
DrawGrid(10, 5.0f);
|
||||
|
||||
for (int x = 0; x < numBlocks; x++)
|
||||
for (int x = 0; x < numBlocks; x++)
|
||||
{
|
||||
for (int y = 0; y < numBlocks; y++)
|
||||
for (int y = 0; y < numBlocks; y++)
|
||||
{
|
||||
for (int z = 0; z < numBlocks; z++)
|
||||
for (int z = 0; z < numBlocks; z++)
|
||||
{
|
||||
// Scale of the blocks depends on x/y/z positions
|
||||
float blockScale = (x + y + z)/30.0f;
|
||||
|
@ -94,9 +94,9 @@ int main()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
EndMode3D();
|
||||
|
||||
|
||||
DrawFPS(10, 10);
|
||||
|
||||
EndDrawing();
|
||||
|
|
|
@ -30,7 +30,7 @@ int main(void)
|
|||
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
|
||||
camera.fovy = 30.0f; // Camera field-of-view Y
|
||||
camera.projection = CAMERA_PERSPECTIVE; // Camera type
|
||||
|
||||
|
||||
// Model loading
|
||||
// NOTE: Diffuse map loaded automatically
|
||||
Model model = LoadModel("resources/plane/plane.gltf");
|
||||
|
@ -77,8 +77,8 @@ int main(void)
|
|||
// Tranformation matrix for rotations
|
||||
model.transform = MatrixRotateXYZ((Vector3){ DEG2RAD*pitch, DEG2RAD*yaw, DEG2RAD*roll });
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
@ -92,7 +92,7 @@ int main(void)
|
|||
DrawGrid(10, 10.0f);
|
||||
|
||||
EndMode3D();
|
||||
|
||||
|
||||
// Draw controls info
|
||||
DrawRectangle(30, 370, 260, 70, Fade(GREEN, 0.5f));
|
||||
DrawRectangleLines(30, 370, 260, 70, Fade(DARKGREEN, 0.5f));
|
||||
|
@ -107,7 +107,7 @@ int main(void)
|
|||
}
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------------------------
|
||||
UnloadModel(model); // Unload model data
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue