Просмотр исходного кода

Merge branch 'master' of https://github.com/raysan5/raylib

raysan5 5 лет назад
Родитель
Сommit
cb3bdf09c6
3 измененных файлов с 24 добавлено и 17 удалено
  1. 0 16
      .gitignore
  2. 9 0
      src/CMakeLists.txt
  3. 15 1
      src/models.c

+ 0 - 16
.gitignore

@@ -34,13 +34,10 @@ Thumbs.db
 
 
 [Bb]in
 [Bb]in
 [Dd]ebug/
 [Dd]ebug/
-[Dd]ebug.win32/
-[Dd]ebug.DLL/
 *.sbr
 *.sbr
 *.sdf
 *.sdf
 obj/
 obj/
 [R]elease/
 [R]elease/
-[Rr]elease.win32/
 _ReSharper*/
 _ReSharper*/
 [Tt]est[Rr]esult*
 [Tt]est[Rr]esult*
 ipch/
 ipch/
@@ -62,7 +59,6 @@ examples/*
 !examples/*/
 !examples/*/
 # Unignore all examples files with extension
 # Unignore all examples files with extension
 !examples/*.c
 !examples/*.c
-!examples/*.lua
 !examples/*.png
 !examples/*.png
 # Unignore examples Makefile
 # Unignore examples Makefile
 !examples/Makefile
 !examples/Makefile
@@ -70,17 +66,6 @@ examples/*
 !examples/raylib_compile_execute.bat
 !examples/raylib_compile_execute.bat
 !examples/raylib_makefile_example.bat
 !examples/raylib_makefile_example.bat
 
 
-# Ignore all games files
-games/*
-# Unignore all games dirs
-!games/*/
-# Unignore all games files with extension
-!games/*.c
-!games/*.png
-# Unignore games makefile
-!games/Makefile
-!games/Makefile.Android
-
 # Ignore files build by xcode
 # Ignore files build by xcode
 *.mode*v*
 *.mode*v*
 *.pbxuser
 *.pbxuser
@@ -112,7 +97,6 @@ build
 
 
 # Unignore These makefiles...
 # Unignore These makefiles...
 !examples/CMakeLists.txt
 !examples/CMakeLists.txt
-!games/CMakeLists.txt
 
 
 # Ignore GNU global tags
 # Ignore GNU global tags
 GPATH
 GPATH

+ 9 - 0
src/CMakeLists.txt

@@ -117,6 +117,15 @@ elseif(${PLATFORM} MATCHES "Raspberry Pi")
   set(PLATFORM_CPP "PLATFORM_RPI")
   set(PLATFORM_CPP "PLATFORM_RPI")
   set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
   set(GRAPHICS "GRAPHICS_API_OPENGL_ES2")
 
 
+  add_definitions(-D_DEFAULT_SOURCE)
+  
+  find_library(GLESV2 brcmGLESv2 HINTS /opt/vc/lib)
+  find_library(EGL brcmEGL HINTS /opt/vc/lib)
+  find_library(BCMHOST bcm_host HINTS /opt/vc/lib)
+  include_directories(/opt/vc/include /opt/vc/include/interface/vmcs_host/linux /opt/vc/include/interface/vcos/pthreads)
+  link_directories(/opt/vc/lib)
+  set(LIBS_PRIVATE ${GLESV2} ${EGL} ${BCMHOST} pthread rt m dl)
+
 endif()
 endif()
 
 
 if (${OPENGL_VERSION})
 if (${OPENGL_VERSION})

+ 15 - 1
src/models.c

@@ -3050,6 +3050,7 @@ static Model LoadIQM(const char *fileName)
 
 
     #define BONE_NAME_LENGTH    32          // BoneInfo name string length
     #define BONE_NAME_LENGTH    32          // BoneInfo name string length
     #define MESH_NAME_LENGTH    32          // Mesh name string length
     #define MESH_NAME_LENGTH    32          // Mesh name string length
+    #define MATERIAL_NAME_LENGTH 32         // Material name string length
 
 
     // IQM file structs
     // IQM file structs
     //-----------------------------------------------------------------------------------
     //-----------------------------------------------------------------------------------
@@ -3182,12 +3183,25 @@ static Model LoadIQM(const char *fileName)
     model.meshCount = iqm.num_meshes;
     model.meshCount = iqm.num_meshes;
     model.meshes = RL_CALLOC(model.meshCount, sizeof(Mesh));
     model.meshes = RL_CALLOC(model.meshCount, sizeof(Mesh));
 
 
+    model.materialCount = model.meshCount;
+    model.materials = (Material *)RL_CALLOC(model.materialCount, sizeof(Material));
+    model.meshMaterial = (int *)RL_CALLOC(model.meshCount, sizeof(int));
+
     char name[MESH_NAME_LENGTH] = { 0 };
     char name[MESH_NAME_LENGTH] = { 0 };
+    char material[MATERIAL_NAME_LENGTH] = { 0 };
 
 
     for (int i = 0; i < model.meshCount; i++)
     for (int i = 0; i < model.meshCount; i++)
     {
     {
         fseek(iqmFile, iqm.ofs_text + imesh[i].name, SEEK_SET);
         fseek(iqmFile, iqm.ofs_text + imesh[i].name, SEEK_SET);
-        fread(name, sizeof(char)*MESH_NAME_LENGTH, 1, iqmFile);     // Mesh name not used...
+        fread(name, sizeof(char)*MESH_NAME_LENGTH, 1, iqmFile);
+
+        fseek(iqmFile, iqm.ofs_text + imesh[i].material, SEEK_SET);
+        fread(material, sizeof(char)*MATERIAL_NAME_LENGTH, 1, iqmFile);
+
+        model.materials[i] = LoadMaterialDefault();
+
+        TRACELOG(LOG_DEBUG, "MODEL: [%s] mesh name (%s), material (%s)", fileName, name, material);
+
         model.meshes[i].vertexCount = imesh[i].num_vertexes;
         model.meshes[i].vertexCount = imesh[i].num_vertexes;
 
 
         model.meshes[i].vertices = RL_CALLOC(model.meshes[i].vertexCount*3, sizeof(float));       // Default vertex positions
         model.meshes[i].vertices = RL_CALLOC(model.meshes[i].vertexCount*3, sizeof(float));       // Default vertex positions