Improved examples
This commit is contained in:
parent
450f0645ed
commit
c041bb4f79
|
|
@ -10,7 +10,6 @@
|
||||||
********************************************************************************************/
|
********************************************************************************************/
|
||||||
|
|
||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
|
|
||||||
#include "raymath.h"
|
#include "raymath.h"
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
|
|
@ -28,10 +27,8 @@ int main()
|
||||||
Image image = LoadImage("resources/cubicmap.png"); // Load cubicmap image (RAM)
|
Image image = LoadImage("resources/cubicmap.png"); // Load cubicmap image (RAM)
|
||||||
Texture2D cubicmap = LoadTextureFromImage(image); // Convert image to texture to display (VRAM)
|
Texture2D cubicmap = LoadTextureFromImage(image); // Convert image to texture to display (VRAM)
|
||||||
|
|
||||||
Model model;
|
Mesh mesh = GenMeshCubicmap(image, VectorOne());
|
||||||
model.mesh = LoadMeshCubicmap(image); // Load cubicmap mesh (generated from image)
|
Model model = LoadModelFromMesh(mesh, false);
|
||||||
model.transform = MatrixIdentity(); // Set default transform matrix
|
|
||||||
model.material = LoadMaterialDefault(); // Load default material
|
|
||||||
|
|
||||||
// NOTE: By default each cube is mapped to one part of texture atlas
|
// NOTE: By default each cube is mapped to one part of texture atlas
|
||||||
Texture2D texture = LoadTexture("resources/cubicmap_atlas.png"); // Load map texture
|
Texture2D texture = LoadTexture("resources/cubicmap_atlas.png"); // Load map texture
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ int main()
|
||||||
skybox.material.shader.locs[LOC_MATRIX_VIEW] = GetShaderLocation(skybox.material.shader, "view");
|
skybox.material.shader.locs[LOC_MATRIX_VIEW] = GetShaderLocation(skybox.material.shader, "view");
|
||||||
|
|
||||||
// Then before rendering, configure the viewport to the actual screen dimensions
|
// Then before rendering, configure the viewport to the actual screen dimensions
|
||||||
Matrix proj = MatrixPerspective(45.0, (double)GetScreenWidth()/(double)GetScreenHeight(), 0.01, 1000.0);
|
Matrix proj = MatrixPerspective(60.0, (double)GetScreenWidth()/(double)GetScreenHeight(), 0.01, 1000.0);
|
||||||
MatrixTranspose(&proj);
|
MatrixTranspose(&proj);
|
||||||
SetShaderValueMatrix(skybox.material.shader, skyProjectionLoc, proj);
|
SetShaderValueMatrix(skybox.material.shader, skyProjectionLoc, proj);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user