Updated example assets
|
@ -26,7 +26,7 @@ int main(void)
|
||||||
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point
|
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.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
|
||||||
camera.fovy = 45.0f; // Camera field-of-view Y
|
camera.fovy = 45.0f; // Camera field-of-view Y
|
||||||
camera.projection = CAMERA_PERSPECTIVE; // Camera mode type
|
camera.projection = CAMERA_PERSPECTIVE; // Camera mode type
|
||||||
|
|
||||||
Vector3 cubePosition = { 0.0f, 0.0f, 0.0f };
|
Vector3 cubePosition = { 0.0f, 0.0f, 0.0f };
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
// Initialization
|
// Initialization
|
||||||
|
@ -37,7 +36,7 @@ int main(void)
|
||||||
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point
|
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.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
|
||||||
camera.fovy = 45.0f; // Camera field-of-view Y
|
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[7];
|
Model model[7];
|
||||||
|
|
||||||
|
@ -52,7 +51,7 @@ int main(void)
|
||||||
int currentModel = 0;
|
int currentModel = 0;
|
||||||
int modelCount = 7;
|
int modelCount = 7;
|
||||||
|
|
||||||
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
|
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
|
||||||
|
|
||||||
SetCameraMode(camera, CAMERA_FREE); // Set free camera mode
|
SetCameraMode(camera, CAMERA_FREE); // Set free camera mode
|
||||||
|
|
||||||
|
@ -66,22 +65,16 @@ int main(void)
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
UpdateCamera(&camera);
|
UpdateCamera(&camera);
|
||||||
|
|
||||||
if(IsKeyReleased(KEY_RIGHT))
|
if (IsKeyReleased(KEY_RIGHT))
|
||||||
{
|
{
|
||||||
currentModel++;
|
currentModel++;
|
||||||
if(currentModel == modelCount)
|
if (currentModel == modelCount) currentModel = 0;
|
||||||
{
|
|
||||||
currentModel = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(IsKeyReleased(KEY_LEFT))
|
if (IsKeyReleased(KEY_LEFT))
|
||||||
{
|
{
|
||||||
currentModel--;
|
currentModel--;
|
||||||
if(currentModel < 0)
|
if (currentModel < 0) currentModel = modelCount - 1;
|
||||||
{
|
|
||||||
currentModel = modelCount - 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
|
@ -104,11 +97,7 @@ int main(void)
|
||||||
|
|
||||||
// De-Initialization
|
// De-Initialization
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
for(int i = 0; i < modelCount; i++) UnloadModel(model[i]); // Unload models
|
||||||
for(int i = 0; i < modelCount; i++)
|
|
||||||
{
|
|
||||||
UnloadModel(model[i]); // Unload model
|
|
||||||
}
|
|
||||||
|
|
||||||
CloseWindow(); // Close window and OpenGL context
|
CloseWindow(); // Close window and OpenGL context
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -14,9 +14,6 @@
|
||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
#include "raymath.h"
|
#include "raymath.h"
|
||||||
|
|
||||||
// Draw angle gauge controls
|
|
||||||
void DrawAngleGauge(Texture2D angleGauge, int x, int y, float angle, char title[], Color color);
|
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
// Initialization
|
// Initialization
|
||||||
|
@ -26,25 +23,16 @@ int main(void)
|
||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [models] example - plane rotations (yaw, pitch, roll)");
|
InitWindow(screenWidth, screenHeight, "raylib [models] example - plane rotations (yaw, pitch, roll)");
|
||||||
|
|
||||||
Texture2D texAngleGauge = LoadTexture("resources/angle_gauge.png");
|
|
||||||
Texture2D texBackground = LoadTexture("resources/background.png");
|
|
||||||
Texture2D texPitch = LoadTexture("resources/pitch.png");
|
|
||||||
Texture2D texPlane = LoadTexture("resources/plane.png");
|
|
||||||
|
|
||||||
RenderTexture2D framebuffer = LoadRenderTexture(192, 192);
|
|
||||||
|
|
||||||
// Model loading
|
|
||||||
Model model = LoadModel("resources/plane.obj"); // Load OBJ model
|
|
||||||
model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = LoadTexture("resources/plane_diffuse.png"); // Set map diffuse texture
|
|
||||||
|
|
||||||
GenTextureMipmaps(&model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture);
|
|
||||||
|
|
||||||
Camera camera = { 0 };
|
Camera camera = { 0 };
|
||||||
camera.position = (Vector3){ 0.0f, 60.0f, -120.0f };// Camera position perspective
|
camera.position = (Vector3){ 0.0f, 50.0f, -120.0f };// Camera position perspective
|
||||||
camera.target = (Vector3){ 0.0f, 12.0f, 0.0f }; // Camera looking at point
|
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.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
|
||||||
camera.fovy = 30.0f; // Camera field-of-view Y
|
camera.fovy = 30.0f; // Camera field-of-view Y
|
||||||
camera.type = CAMERA_PERSPECTIVE; // Camera type
|
camera.projection = CAMERA_PERSPECTIVE; // Camera type
|
||||||
|
|
||||||
|
// Model loading
|
||||||
|
// NOTE: Diffuse map loaded automatically
|
||||||
|
Model model = LoadModel("resources/plane/plane.gltf");
|
||||||
|
|
||||||
float pitch = 0.0f;
|
float pitch = 0.0f;
|
||||||
float roll = 0.0f;
|
float roll = 0.0f;
|
||||||
|
@ -58,14 +46,13 @@ int main(void)
|
||||||
{
|
{
|
||||||
// Update
|
// Update
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
// Plane pitch (x-axis) controls
|
||||||
// Plane roll (x-axis) controls
|
if (IsKeyDown(KEY_DOWN)) pitch += 0.6f;
|
||||||
if (IsKeyDown(KEY_LEFT)) roll += 1.0f;
|
else if (IsKeyDown(KEY_UP)) pitch -= 0.6f;
|
||||||
else if (IsKeyDown(KEY_RIGHT)) roll -= 1.0f;
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (roll > 0.0f) roll -= 0.5f;
|
if (pitch > 0.3f) pitch -= 0.3f;
|
||||||
else if (roll < 0.0f) roll += 0.5f;
|
else if (pitch < -0.3f) pitch += 0.3f;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Plane yaw (y-axis) controls
|
// Plane yaw (y-axis) controls
|
||||||
|
@ -77,124 +64,53 @@ int main(void)
|
||||||
else if (yaw < 0.0f) yaw += 0.5f;
|
else if (yaw < 0.0f) yaw += 0.5f;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Plane pitch (z-axis) controls
|
// Plane roll (z-axis) controls
|
||||||
if (IsKeyDown(KEY_DOWN)) pitch += 0.6f;
|
if (IsKeyDown(KEY_LEFT)) roll += 1.0f;
|
||||||
else if (IsKeyDown(KEY_UP)) pitch -= 0.6f;
|
else if (IsKeyDown(KEY_RIGHT)) roll -= 1.0f;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (pitch > 0.3f) pitch -= 0.3f;
|
if (roll > 0.0f) roll -= 0.5f;
|
||||||
else if (pitch < -0.3f) pitch += 0.3f;
|
else if (roll < 0.0f) roll += 0.5f;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wraps the phase of an angle to fit between -180 and +180 degrees
|
// Tranformation matrix for rotations
|
||||||
int pitchOffset = pitch;
|
|
||||||
while (pitchOffset > 180) pitchOffset -= 360;
|
|
||||||
while (pitchOffset < -180) pitchOffset += 360;
|
|
||||||
pitchOffset *= 10;
|
|
||||||
|
|
||||||
/* matrix transform done with multiplication to combine rotations
|
|
||||||
Matrix transform = MatrixIdentity();
|
|
||||||
|
|
||||||
transform = MatrixMultiply(transform, MatrixRotateZ(DEG2RAD*roll));
|
|
||||||
transform = MatrixMultiply(transform, MatrixRotateX(DEG2RAD*pitch));
|
|
||||||
transform = MatrixMultiply(transform, MatrixRotateY(DEG2RAD*yaw));
|
|
||||||
|
|
||||||
model.transform = transform;
|
|
||||||
*/
|
|
||||||
// matrix created from multiple axes at once
|
|
||||||
model.transform = MatrixRotateXYZ((Vector3){DEG2RAD*pitch,DEG2RAD*yaw,DEG2RAD*roll});
|
model.transform = MatrixRotateXYZ((Vector3){DEG2RAD*pitch,DEG2RAD*yaw,DEG2RAD*roll});
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
// Draw framebuffer texture (Ahrs Display)
|
|
||||||
int centerX = framebuffer.texture.width/2;
|
|
||||||
int centerY = framebuffer.texture.height/2;
|
|
||||||
|
|
||||||
BeginTextureMode(framebuffer);
|
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
|
||||||
BeginBlendMode(BLEND_ALPHA);
|
|
||||||
|
|
||||||
DrawTexturePro(texBackground, (Rectangle){ 0, 0, texBackground.width, texBackground.height },
|
|
||||||
(Rectangle){ centerX, centerY, texBackground.width, texBackground.height},
|
|
||||||
(Vector2){ texBackground.width/2, texBackground.height/2 + pitchOffset }, roll, WHITE);
|
|
||||||
|
|
||||||
DrawTexturePro(texPitch, (Rectangle){ 0, 0, texPitch.width, texPitch.height },
|
|
||||||
(Rectangle){ centerX, centerY, texPitch.width, texPitch.height },
|
|
||||||
(Vector2){ texPitch.width/2, texPitch.height/2 + pitchOffset }, roll, WHITE);
|
|
||||||
|
|
||||||
DrawTexturePro(texPlane, (Rectangle){ 0, 0, texPlane.width, texPlane.height },
|
|
||||||
(Rectangle){ centerX, centerY, texPlane.width, texPlane.height },
|
|
||||||
(Vector2){ texPlane.width/2, texPlane.height/2 }, 0, WHITE);
|
|
||||||
|
|
||||||
EndBlendMode();
|
|
||||||
|
|
||||||
EndTextureMode();
|
|
||||||
|
|
||||||
// Draw 3D model (recomended to draw 3D always before 2D)
|
// Draw 3D model (recomended to draw 3D always before 2D)
|
||||||
BeginMode3D(camera);
|
BeginMode3D(camera);
|
||||||
|
|
||||||
DrawModel(model, (Vector3){ 0, 6.0f, 0 }, 1.0f, WHITE); // Draw 3d model with texture
|
DrawModel(model, (Vector3){ 0.0f, 0.0f, 15.0f }, 0.25f, WHITE); // Draw 3d model with texture
|
||||||
DrawGrid(10, 10.0f);
|
DrawGrid(10, 10.0f);
|
||||||
|
|
||||||
EndMode3D();
|
EndMode3D();
|
||||||
|
|
||||||
|
// Draw controls info
|
||||||
|
DrawRectangle(30, 370, 260, 70, Fade(GREEN, 0.5f));
|
||||||
|
DrawRectangleLines(30, 370, 260, 70, Fade(DARKGREEN, 0.5f));
|
||||||
|
DrawText("Pitch controlled with: KEY_UP / KEY_DOWN", 40, 380, 10, DARKGRAY);
|
||||||
|
DrawText("Roll controlled with: KEY_LEFT / KEY_RIGHT", 40, 400, 10, DARKGRAY);
|
||||||
|
DrawText("Yaw controlled with: KEY_A / KEY_S", 40, 420, 10, DARKGRAY);
|
||||||
|
|
||||||
// Draw 2D GUI stuff
|
DrawText("(c) WWI Plane Model created by GiaHanLam", screenWidth - 240, screenHeight - 20, 10, DARKGRAY);
|
||||||
DrawAngleGauge(texAngleGauge, 80, 70, roll, "roll", RED);
|
|
||||||
DrawAngleGauge(texAngleGauge, 190, 70, pitch, "pitch", GREEN);
|
|
||||||
DrawAngleGauge(texAngleGauge, 300, 70, yaw, "yaw", SKYBLUE);
|
|
||||||
|
|
||||||
DrawRectangle(30, 360, 260, 70, Fade(SKYBLUE, 0.5f));
|
|
||||||
DrawRectangleLines(30, 360, 260, 70, Fade(DARKBLUE, 0.5f));
|
|
||||||
DrawText("Pitch controlled with: KEY_UP / KEY_DOWN", 40, 370, 10, DARKGRAY);
|
|
||||||
DrawText("Roll controlled with: KEY_LEFT / KEY_RIGHT", 40, 390, 10, DARKGRAY);
|
|
||||||
DrawText("Yaw controlled with: KEY_A / KEY_S", 40, 410, 10, DARKGRAY);
|
|
||||||
|
|
||||||
// Draw framebuffer texture
|
|
||||||
DrawTextureRec(framebuffer.texture, (Rectangle){ 0, 0, framebuffer.texture.width, -framebuffer.texture.height },
|
|
||||||
(Vector2){ screenWidth - framebuffer.texture.width - 20, 20 }, Fade(WHITE, 0.8f));
|
|
||||||
|
|
||||||
DrawRectangleLines(screenWidth - framebuffer.texture.width - 20, 20, framebuffer.texture.width, framebuffer.texture.height, DARKGRAY);
|
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
|
|
||||||
// De-Initialization
|
// De-Initialization
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
UnloadModel(model); // Unload model data
|
||||||
|
|
||||||
// Unload all loaded data
|
CloseWindow(); // Close window and OpenGL context
|
||||||
UnloadTexture(model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture);
|
|
||||||
UnloadModel(model);
|
|
||||||
|
|
||||||
UnloadRenderTexture(framebuffer);
|
|
||||||
|
|
||||||
UnloadTexture(texAngleGauge);
|
|
||||||
UnloadTexture(texBackground);
|
|
||||||
UnloadTexture(texPitch);
|
|
||||||
UnloadTexture(texPlane);
|
|
||||||
|
|
||||||
CloseWindow(); // Close window and OpenGL context
|
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw angle gauge controls
|
|
||||||
void DrawAngleGauge(Texture2D angleGauge, int x, int y, float angle, char title[], Color color)
|
|
||||||
{
|
|
||||||
Rectangle srcRec = { 0, 0, angleGauge.width, angleGauge.height };
|
|
||||||
Rectangle dstRec = { x, y, angleGauge.width, angleGauge.height };
|
|
||||||
Vector2 origin = { angleGauge.width/2, angleGauge.height/2};
|
|
||||||
int textSize = 20;
|
|
||||||
|
|
||||||
DrawTexturePro(angleGauge, srcRec, dstRec, origin, angle, color);
|
|
||||||
|
|
||||||
DrawText(TextFormat("%5.1f", angle), x - MeasureText(TextFormat("%5.1f", angle), textSize) / 2, y + 10, textSize, DARKGRAY);
|
|
||||||
DrawText(title, x - MeasureText(title, textSize) / 2, y + 60, textSize, DARKGRAY);
|
|
||||||
}
|
|
||||||
|
|
Before Width: | Height: | Size: 180 KiB After Width: | Height: | Size: 143 KiB |
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 189 B |
Before Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 1.7 KiB |
9
examples/models/resources/plane/LICENSE
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
WWI Plane Model created by GiaHanLam (https://sketchfab.com/GiaHanLam)
|
||||||
|
This model is free to use, licensed as Creative Commons Attribution (CC-BY 4.0)
|
||||||
|
|
||||||
|
License details: https://creativecommons.org/licenses/by/4.0/
|
||||||
|
|
||||||
|
As per the license, author must be credited and commercial use is allowed.
|
||||||
|
|
||||||
|
This model was donwload from author Sketchfab account: https://sketchfab.com/3d-models/wwi-plane-model-f0d39a6daacd4925a8922db193886715
|
||||||
|
|
BIN
examples/models/resources/plane/plane.bin
Normal file
327
examples/models/resources/plane/plane.gltf
Normal file
|
@ -0,0 +1,327 @@
|
||||||
|
{
|
||||||
|
"accessors": [
|
||||||
|
{
|
||||||
|
"bufferView": 2,
|
||||||
|
"componentType": 5126,
|
||||||
|
"count": 3446,
|
||||||
|
"max": [
|
||||||
|
143.99604797363281,
|
||||||
|
168.74668884277344,
|
||||||
|
75.31597900390625
|
||||||
|
],
|
||||||
|
"min": [
|
||||||
|
-143.99604797363281,
|
||||||
|
-43.94732666015625,
|
||||||
|
-49.556678771972656
|
||||||
|
],
|
||||||
|
"type": "VEC3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"bufferView": 2,
|
||||||
|
"byteOffset": 41352,
|
||||||
|
"componentType": 5126,
|
||||||
|
"count": 3446,
|
||||||
|
"max": [
|
||||||
|
1,
|
||||||
|
0.99916732311248779,
|
||||||
|
0.99978786706924438
|
||||||
|
],
|
||||||
|
"min": [
|
||||||
|
-1,
|
||||||
|
-0.99928808212280273,
|
||||||
|
-0.99977350234985352
|
||||||
|
],
|
||||||
|
"type": "VEC3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"bufferView": 3,
|
||||||
|
"componentType": 5126,
|
||||||
|
"count": 3446,
|
||||||
|
"max": [
|
||||||
|
1,
|
||||||
|
1,
|
||||||
|
1,
|
||||||
|
1
|
||||||
|
],
|
||||||
|
"min": [
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"type": "VEC4"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"bufferView": 1,
|
||||||
|
"componentType": 5126,
|
||||||
|
"count": 3446,
|
||||||
|
"max": [
|
||||||
|
4.8965663909912109,
|
||||||
|
0.99786919355392456
|
||||||
|
],
|
||||||
|
"min": [
|
||||||
|
0.0036561768501996994,
|
||||||
|
0.0083234198391437531
|
||||||
|
],
|
||||||
|
"type": "VEC2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"bufferView": 0,
|
||||||
|
"componentType": 5125,
|
||||||
|
"count": 7692,
|
||||||
|
"max": [
|
||||||
|
3445
|
||||||
|
],
|
||||||
|
"min": [
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"type": "SCALAR"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"asset": {
|
||||||
|
"extras": {
|
||||||
|
"author": "GiaHanLam (https://sketchfab.com/GiaHanLam)",
|
||||||
|
"license": "CC-BY-4.0 (http://creativecommons.org/licenses/by/4.0/)",
|
||||||
|
"source": "https://sketchfab.com/3d-models/wwi-plane-model-f0d39a6daacd4925a8922db193886715",
|
||||||
|
"title": "WWI Plane Model"
|
||||||
|
},
|
||||||
|
"generator": "Sketchfab-8.25.0",
|
||||||
|
"version": "2.0"
|
||||||
|
},
|
||||||
|
"bufferViews": [
|
||||||
|
{
|
||||||
|
"buffer": 0,
|
||||||
|
"byteLength": 30768,
|
||||||
|
"byteOffset": 0,
|
||||||
|
"name": "floatBufferViews",
|
||||||
|
"target": 34963
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"buffer": 0,
|
||||||
|
"byteLength": 27568,
|
||||||
|
"byteOffset": 30768,
|
||||||
|
"byteStride": 8,
|
||||||
|
"name": "floatBufferViews",
|
||||||
|
"target": 34962
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"buffer": 0,
|
||||||
|
"byteLength": 82704,
|
||||||
|
"byteOffset": 58336,
|
||||||
|
"byteStride": 12,
|
||||||
|
"name": "floatBufferViews",
|
||||||
|
"target": 34962
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"buffer": 0,
|
||||||
|
"byteLength": 55136,
|
||||||
|
"byteOffset": 141040,
|
||||||
|
"byteStride": 16,
|
||||||
|
"name": "floatBufferViews",
|
||||||
|
"target": 34962
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"buffers": [
|
||||||
|
{
|
||||||
|
"byteLength": 196176,
|
||||||
|
"uri": "plane.bin"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"images": [
|
||||||
|
{
|
||||||
|
"uri": "plane_diffuse.png"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"materials": [
|
||||||
|
{
|
||||||
|
"doubleSided": true,
|
||||||
|
"name": "Material_24",
|
||||||
|
"pbrMetallicRoughness": {
|
||||||
|
"baseColorFactor": [
|
||||||
|
1,
|
||||||
|
1,
|
||||||
|
1,
|
||||||
|
1
|
||||||
|
],
|
||||||
|
"baseColorTexture": {
|
||||||
|
"index": 0,
|
||||||
|
"texCoord": 0
|
||||||
|
},
|
||||||
|
"metallicFactor": 0,
|
||||||
|
"roughnessFactor": 0.59999999999999998
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"meshes": [
|
||||||
|
{
|
||||||
|
"name": "BODY_Material #24_0",
|
||||||
|
"primitives": [
|
||||||
|
{
|
||||||
|
"attributes": {
|
||||||
|
"COLOR_0": 2,
|
||||||
|
"NORMAL": 1,
|
||||||
|
"POSITION": 0,
|
||||||
|
"TEXCOORD_0": 3
|
||||||
|
},
|
||||||
|
"indices": 4,
|
||||||
|
"material": 0,
|
||||||
|
"mode": 4
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"children": [
|
||||||
|
1
|
||||||
|
],
|
||||||
|
"name": "RootNode (gltf orientation matrix)",
|
||||||
|
"rotation": [
|
||||||
|
-0.70710678118654746,
|
||||||
|
-0,
|
||||||
|
-0,
|
||||||
|
0.70710678118654757
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"children": [
|
||||||
|
2
|
||||||
|
],
|
||||||
|
"name": "RootNode (model correction matrix)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"children": [
|
||||||
|
3
|
||||||
|
],
|
||||||
|
"matrix": [
|
||||||
|
1,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
-1,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
1
|
||||||
|
],
|
||||||
|
"name": "base"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"children": [
|
||||||
|
4,
|
||||||
|
6
|
||||||
|
],
|
||||||
|
"name": "RootNode"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"children": [
|
||||||
|
5
|
||||||
|
],
|
||||||
|
"matrix": [
|
||||||
|
1,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
2.2204460492503131e-16,
|
||||||
|
-1,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
2.2204460492503131e-16,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
1
|
||||||
|
],
|
||||||
|
"name": "BODY"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"mesh": 0,
|
||||||
|
"name": "BODY_Material #24_0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"children": [
|
||||||
|
7
|
||||||
|
],
|
||||||
|
"matrix": [
|
||||||
|
1,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
0,
|
||||||
|
-680,
|
||||||
|
0,
|
||||||
|
90,
|
||||||
|
1
|
||||||
|
],
|
||||||
|
"name": "Sky001"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"children": [
|
||||||
|
8
|
||||||
|
],
|
||||||
|
"matrix": [
|
||||||
|
1,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
2.2204460492503131e-16,
|
||||||
|
1,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
-1,
|
||||||
|
2.2204460492503131e-16,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
1
|
||||||
|
],
|
||||||
|
"name": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"samplers": [
|
||||||
|
{
|
||||||
|
"magFilter": 9729,
|
||||||
|
"minFilter": 9987,
|
||||||
|
"wrapS": 10497,
|
||||||
|
"wrapT": 10497
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"scene": 0,
|
||||||
|
"scenes": [
|
||||||
|
{
|
||||||
|
"name": "OSG_Scene",
|
||||||
|
"nodes": [
|
||||||
|
0
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"textures": [
|
||||||
|
{
|
||||||
|
"sampler": 0,
|
||||||
|
"source": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
BIN
examples/models/resources/plane/plane_diffuse.png
Normal file
After Width: | Height: | Size: 804 KiB |
Before Width: | Height: | Size: 295 KiB |
|
@ -173,7 +173,7 @@ void DrawLineBezierQuad(Vector2 startPos, Vector2 endPos, Vector2 controlPos, fl
|
||||||
current.y = a*startPos.y + b*controlPos.y + c*endPos.y;
|
current.y = a*startPos.y + b*controlPos.y + c*endPos.y;
|
||||||
current.x = a*startPos.x + b*controlPos.x + c*endPos.x;
|
current.x = a*startPos.x + b*controlPos.x + c*endPos.x;
|
||||||
|
|
||||||
DrawLineEx(previous,current,thick,color);
|
DrawLineEx(previous, current, thick, color);
|
||||||
|
|
||||||
previous = current;
|
previous = current;
|
||||||
}
|
}
|
||||||
|
|