Code used to test some features (and resources)

This commit is contained in:
raysan5 2014-04-19 16:54:48 +02:00
commit f76a00adc1
25 changed files with 5160 additions and 12 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

4731
tests/resources/cat.obj Normal file

File diff suppressed because it is too large Load diff

BIN
tests/resources/catsham.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 308 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
tests/resources/mouse.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

79
tests/test_3d_models.c Normal file
View file

@ -0,0 +1,79 @@
/*******************************************************************************************
*
* raylib test - Load and draw a 3d model (OBJ)
*
* This test has been created using raylib 1.1 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
*
********************************************************************************************/
#include "raylib.h"
int main()
{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
Vector3 position = { 0.0, 0.0, 0.0 };
// Define the camera to look into our 3d world
Camera camera = {{ 10.0, 8.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
InitWindow(screenWidth, screenHeight, "raylib test - 3d models in OpenGL 3.3+");
Texture2D texture = LoadTexture("resources/catwhite.png");
Model cat = LoadModel("resources/cat.obj");
SetModelTexture(&cat, texture);
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
if (IsKeyDown(KEY_LEFT)) position.x -= 0.2;
if (IsKeyDown(KEY_RIGHT)) position.x += 0.2;
if (IsKeyDown(KEY_UP)) position.z -= 0.2;
if (IsKeyDown(KEY_DOWN)) position.z += 0.2;
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
Begin3dMode(camera);
DrawModel(cat, position, 0.1f, BEIGE); // OK_GL11, OK_GL33
//DrawModelWires(cat, position, 0.1f, RED); // OK_GL11, OK_GL33
DrawGrid(10.0, 1.0); // Draw a grid
DrawGizmo(position);
End3dMode();
DrawFPS(10, 10);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadTexture(texture); // Unload texture
UnloadModel(cat); // Unload model
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

View file

@ -2,10 +2,10 @@
* *
* raylib test - Testing DrawBillboard() and DrawBillboardRec() * raylib test - Testing DrawBillboard() and DrawBillboardRec()
* *
* This example has been created using raylib 1.0 (www.raylib.com) * This test has been created using raylib 1.0 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
* *
********************************************************************************************/ ********************************************************************************************/

View file

@ -2,7 +2,7 @@
* *
* raylib test - Testing FormatText() function * raylib test - Testing FormatText() function
* *
* This example has been created using raylib 1.0 (www.raylib.com) * This test has been created using raylib 1.0 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com)

View file

@ -2,10 +2,10 @@
* *
* raylib test - Testing Heightmap Loading and Drawing * raylib test - Testing Heightmap Loading and Drawing
* *
* This example has been created using raylib 1.0 (www.raylib.com) * This test has been created using raylib 1.0 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
* *
********************************************************************************************/ ********************************************************************************************/
@ -25,11 +25,13 @@ int main()
InitWindow(screenWidth, screenHeight, "raylib test - Heightmap loading and drawing"); InitWindow(screenWidth, screenHeight, "raylib test - Heightmap loading and drawing");
Image img = LoadImage("heightmap.png"); Image img = LoadImage("resources/heightmap.png");
Model map = LoadHeightmap(img, 4); Model map = LoadHeightmap(img, 4);
Texture2D tex = CreateTexture(img); Texture2D texture = CreateTexture(img, false);
UnloadImage(img); UnloadImage(img);
SetModelTexture(&map, texture);
SetTargetFPS(60); // Set our game to run at 60 frames-per-second SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
@ -49,8 +51,7 @@ int main()
Begin3dMode(camera); Begin3dMode(camera);
//DrawModel(map, position, 0.5f, MAROON); DrawModel(map, position, 0.5f, MAROON);
DrawModelEx(map, tex, position, 0.5f, WHITE); // Draw 3d model with texture
DrawGrid(10.0, 1.0); // Draw a grid DrawGrid(10.0, 1.0); // Draw a grid

View file

@ -2,7 +2,7 @@
* *
* raylib test - Testing LoadImage() and CreateTexture() * raylib test - Testing LoadImage() and CreateTexture()
* *
* This example has been created using raylib 1.0 (www.raylib.com) * This test has been created using raylib 1.0 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com)
@ -23,7 +23,7 @@ int main()
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required) // NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
Image img = LoadImage("resources/raylib_logo.png"); Image img = LoadImage("resources/raylib_logo.png");
Texture2D texture = CreateTexture(img); Texture2D texture = CreateTexture(img, false);
UnloadImage(img); UnloadImage(img);
//--------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------

View file

@ -2,7 +2,7 @@
* *
* raylib test - Testing GetMouseWheelMove() * raylib test - Testing GetMouseWheelMove()
* *
* This example has been created using raylib 1.0 (www.raylib.com) * This test has been created using raylib 1.0 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* *
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com) * Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com)

Some files were not shown because too many files have changed in this diff Show more