Browse Source

Reviewed models examples paths

pull/2051/head
raysan5 3 years ago
parent
commit
f1659d78d3
5 changed files with 23 additions and 23 deletions
  1. +5
    -5
      examples/models/models_animation.c
  2. +8
    -8
      examples/models/models_loading_gltf.c
  3. +2
    -2
      examples/models/models_loading_vox.c
  4. +6
    -6
      examples/models/models_mesh_picking.c
  5. +2
    -2
      src/rmodels.c

+ 5
- 5
examples/models/models_animation.c View File

@ -37,17 +37,17 @@ int main(void)
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 45.0f; // Camera field-of-view Y
camera.projection = CAMERA_PERSPECTIVE; // Camera mode type
camera.projection = CAMERA_PERSPECTIVE; // Camera mode type
Model model = LoadModel("resources/guy/guy.iqm"); // Load the animated model mesh and basic data
Texture2D texture = LoadTexture("resources/guy/guytex.png"); // Load model texture and set material
SetMaterialTexture(&model.materials[0], MATERIAL_MAP_DIFFUSE, texture); // Set model material map texture
Model model = LoadModel("resources/models/iqm/guy.iqm"); // Load the animated model mesh and basic data
Texture2D texture = LoadTexture("resources/models/iqm/guytex.png"); // Load model texture and set material
SetMaterialTexture(&model.materials[0], MATERIAL_MAP_DIFFUSE, texture); // Set model material map texture
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
// Load animation data
int animsCount = 0;
ModelAnimation *anims = LoadModelAnimations("resources/guy/guyanim.iqm", &animsCount);
ModelAnimation *anims = LoadModelAnimations("resources/models/iqm/guyanim.iqm", &animsCount);
int animFrameCounter = 0;
SetCameraMode(camera, CAMERA_FREE); // Set free camera mode

+ 8
- 8
examples/models/models_loading_gltf.c View File

@ -42,14 +42,14 @@ int main(void)
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");
model[6] = LoadModel("resources/gltf/vertex_colored_object.glb");
model[7] = LoadModel("resources/gltf/girl.glb");
model[0] = LoadModel("resources/models/gltf/raylib_32x32.glb");
model[1] = LoadModel("resources/models/gltf/rigged_figure.glb");
model[2] = LoadModel("resources/models/gltf/GearboxAssy.glb");
model[3] = LoadModel("resources/models/gltf/BoxAnimated.glb");
model[4] = LoadModel("resources/models/gltf/AnimatedTriangle.gltf");
model[5] = LoadModel("resources/models/gltf/AnimatedMorphCube.glb");
model[6] = LoadModel("resources/models/gltf/vertex_colored_object.glb");
model[7] = LoadModel("resources/models/gltf/girl.glb");
int currentModel = 0;

+ 2
- 2
examples/models/models_loading_vox.c View File

@ -5,9 +5,9 @@
* This example has been created using raylib 3.8 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
* Example contributed by Johann Nadalutti
* Example contributed by Johann Nadalutti (@procfxgen)
*
* Copyright (c) 2021 Johann Nadalutti
* Copyright (c) 2021 Johann Nadalutti (@procfxgen)
*
********************************************************************************************/

+ 6
- 6
examples/models/models_mesh_picking.c View File

@ -31,16 +31,16 @@ int main(void)
camera.target = (Vector3){ 0.0f, 8.0f, 0.0f }; // Camera looking at point
camera.up = (Vector3){ 0.0f, 1.6f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 45.0f; // Camera field-of-view Y
camera.projection = CAMERA_PERSPECTIVE; // Camera mode type
camera.projection = CAMERA_PERSPECTIVE; // Camera mode type
Ray ray = { 0 }; // Picking ray
Model tower = LoadModel("resources/models/turret.obj"); // Load OBJ model
Texture2D texture = LoadTexture("resources/models/turret_diffuse.png"); // Load model texture
tower.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set model diffuse texture
Model tower = LoadModel("resources/models/obj/turret.obj"); // Load OBJ model
Texture2D texture = LoadTexture("resources/models/obj/turret_diffuse.png"); // Load model texture
tower.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set model diffuse texture
Vector3 towerPos = { 0.0f, 0.0f, 0.0f }; // Set model position
BoundingBox towerBBox = GetMeshBoundingBox(tower.meshes[0]); // Get mesh bounding box
Vector3 towerPos = { 0.0f, 0.0f, 0.0f }; // Set model position
BoundingBox towerBBox = GetMeshBoundingBox(tower.meshes[0]); // Get mesh bounding box
// Ground quad
Vector3 g0 = (Vector3){ -50.0f, 0.0f, -50.0f };

+ 2
- 2
src/rmodels.c View File

@ -4289,8 +4289,8 @@ static Model LoadIQM(const char *fileName)
// Load IQM animation data
static ModelAnimation* LoadIQMModelAnimations(const char *fileName, unsigned int *animCount)
{
#define IQM_MAGIC "INTERQUAKEMODEL" // IQM file magic number
#define IQM_VERSION 2 // only IQM version 2 supported
#define IQM_MAGIC "INTERQUAKEMODEL" // IQM file magic number
#define IQM_VERSION 2 // only IQM version 2 supported
unsigned int fileSize = 0;
unsigned char *fileData = LoadFileData(fileName, &fileSize);

Loading…
Cancel
Save