Watch
2
0
Fork
You've already forked raylib-cs
0

Add additional model resources

This commit is contained in:
Rgebee 2024-06-18 21:16:32 +01:00
commit d5585eca37
18 changed files with 17 additions and 8 deletions

3
.gitignore vendored
View file

@ -34,6 +34,9 @@
[Oo]bj/
[Ll]og/
# Allow obj models to be included
!Examples/resources/models/obj/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot

View file

@ -68,17 +68,20 @@ public class ModelLoading
if (IsFileDropped())
{
string[] files = Raylib.GetDroppedFiles();
string[] droppedFiles = Raylib.GetDroppedFiles();
if (files.Length == 1)
if (droppedFiles.Length == 1)
{
if (IsFileExtension(files[0], ".obj") ||
IsFileExtension(files[0], ".gltf") ||
IsFileExtension(files[0], ".iqm")
if (IsFileExtension(droppedFiles[0], ".obj") ||
IsFileExtension(droppedFiles[0], ".gltf") ||
IsFileExtension(droppedFiles[0], ".glb") ||
IsFileExtension(droppedFiles[0], ".vox") ||
IsFileExtension(droppedFiles[0], ".iqm") ||
IsFileExtension(droppedFiles[0], ".m3d")
)
{
UnloadModel(model);
model = LoadModel(files[0]);
model = LoadModel(droppedFiles[0]);
// Set current map diffuse texture
Raylib.SetMaterialTexture(ref model, 0, MaterialMapIndex.Albedo, ref texture);
@ -87,11 +90,11 @@ public class ModelLoading
// TODO: Move camera position from target enough distance to visualize model properly
}
else if (IsFileExtension(files[0], ".png"))
else if (IsFileExtension(droppedFiles[0], ".png"))
{
// Unload model texture and load new one
UnloadTexture(texture);
texture = LoadTexture(files[0]);
texture = LoadTexture(droppedFiles[0]);
Raylib.SetMaterialTexture(ref model, 0, MaterialMapIndex.Albedo, ref texture);
}
}

View file

@ -1,2 +1,5 @@
robot.glb model by @Quaternius (https://www.patreon.com/quaternius)
Licensed under CC0 1.0 Universal (CC0 1.0) - Public Domain Dedication (https://creativecommons.org/publicdomain/zero/1.0/)
greenman.glb, greenman_hat.glb, greenman_sword.glb, greenman_shield.glb models by @iP (https://github.com/ipzaur)
Licensed under CC0 1.0 Universal (CC0 1.0) - Public Domain Dedication (https://creativecommons.org/publicdomain/zero/1.0/)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 434 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 383 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 380 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 804 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 371 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 334 KiB

Binary file not shown.