Ver Fonte

Fixes for Windows on Direct3D9

JoshEngebretson há 10 anos atrás
pai
commit
ccc7e7fe97

+ 4 - 3
Source/Atomic/Engine/Engine.cpp

@@ -54,6 +54,9 @@
 #ifdef ATOMIC_ATOMIC2D
 #include "../Atomic2D/Atomic2D.h"
 #endif
+#ifdef ATOMIC_3D
+#include "../Atomic3D/Atomic3D.h"
+#endif
 
 #if defined(EMSCRIPTEN) && defined(ATOMIC_TESTING)
 #include <emscripten.h>
@@ -162,8 +165,7 @@ bool Engine::Initialize(const VariantMap& parameters)
     if (!headless_)
     {
         context_->RegisterSubsystem(new Graphics(context_));
-#ifdef ATOMIC_3D
-        void RegisterAtomic3DLibrary(Context* context);
+#ifdef ATOMIC_3D        
         RegisterAtomic3DLibrary(context_);
 #endif
         context_->RegisterSubsystem(new Renderer(context_));
@@ -173,7 +175,6 @@ bool Engine::Initialize(const VariantMap& parameters)
         // Register graphics library objects explicitly in headless mode to allow them to work without using actual GPU resources
         RegisterGraphicsLibrary(context_);
 #ifdef ATOMIC_3D
-        void RegisterAtomic3DLibrary(Context* context);
         RegisterAtomic3DLibrary(context_);
 #endif
     }

+ 4 - 15
Source/Atomic/Graphics/Direct3D9/D3D9Graphics.cpp

@@ -25,29 +25,18 @@
 #include "../../Core/Context.h"
 #include "../../Core/ProcessUtils.h"
 #include "../../Core/Profiler.h"
-#include "../../Graphics/AnimatedModel.h"
-#include "../../Graphics/Animation.h"
-#include "../../Graphics/AnimationController.h"
 #include "../../Graphics/Camera.h"
-#include "../../Graphics/CustomGeometry.h"
 #include "../../Graphics/DebugRenderer.h"
-#include "../../Graphics/DecalSet.h"
 #include "../../Graphics/Graphics.h"
 #include "../../Graphics/GraphicsEvents.h"
 #include "../../Graphics/GraphicsImpl.h"
 #include "../../Graphics/IndexBuffer.h"
 #include "../../Graphics/Material.h"
 #include "../../Graphics/Octree.h"
-#include "../../Graphics/ParticleEffect.h"
-#include "../../Graphics/ParticleEmitter.h"
 #include "../../Graphics/Shader.h"
 #include "../../Graphics/ShaderPrecache.h"
 #include "../../Graphics/ShaderProgram.h"
-#include "../../Graphics/Skybox.h"
-#include "../../Graphics/StaticModelGroup.h"
 #include "../../Graphics/Technique.h"
-#include "../../Graphics/Terrain.h"
-#include "../../Graphics/TerrainPatch.h"
 #include "../../Graphics/Texture2D.h"
 #include "../../Graphics/Texture3D.h"
 #include "../../Graphics/TextureCube.h"
@@ -58,7 +47,7 @@
 #include "../../IO/Log.h"
 #include "../../Resource/ResourceCache.h"
 
-#include <SDL/SDL_syswm.h>
+#include <SDL/include/SDL_syswm.h>
 
 #include "../../DebugNew.h"
 
@@ -647,7 +636,7 @@ void Graphics::Close()
     }
 }
 
-bool Graphics::TakeScreenShot(Image& destImage)
+bool Graphics::TakeScreenShot(Image* destImage)
 {
     PROFILE(TakeScreenShot);
 
@@ -715,8 +704,8 @@ bool Graphics::TakeScreenShot(Image& destImage)
         return false;
     }
 
-    destImage.SetSize(width_, height_, 3);
-    unsigned char* destData = destImage.GetData();
+    destImage->SetSize(width_, height_, 3);
+    unsigned char* destData = destImage->GetData();
 
     if (surfaceDesc.Format == D3DFMT_R5G6B5)
     {

+ 1 - 1
Source/Atomic/Graphics/Direct3D9/D3D9GraphicsImpl.h

@@ -25,7 +25,7 @@
 #include "../../Math/Color.h"
 
 #include <d3d9.h>
-#include <SDL/SDL.h>
+#include <SDL/include/SDL.h>
 
 namespace Atomic
 {

+ 2 - 2
Source/Atomic/IO/FileSystem.cpp

@@ -844,11 +844,11 @@ void FileSystem::ScanDirInternal(Vector<String>& result, String path, const Stri
                         result.Push(deltaPath + fileName);
                 }
             }
-        }
-        while (FindNextFileW(handle, &info));
+        } while (FindNextFileW(handle, &info));
 
         FindClose(handle);
     }
+}
 #else
     DIR* dir;
     struct dirent* de;

+ 6 - 1
Source/AtomicJS/Javascript/JSComponent.cpp

@@ -99,7 +99,12 @@ public:
             {
                 ResourceCache* cache = context_->GetSubsystem<ResourceCache>();
                 JSComponentFile* componentFile = cache->GetResource<JSComponentFile>(split[1]);
-                ptr = componentFile->CreateJSComponent();
+                if (componentFile)
+                    ptr = componentFile->CreateJSComponent();
+                else
+                {
+                    LOGERRORF("Unable to load component file %s", split[1].CString());
+                }
             }
 
         }

+ 1 - 1
Source/AtomicJS/Javascript/JSComponentFile.cpp

@@ -315,7 +315,7 @@ bool JSComponentFile::BeginLoad(Deserializer& source)
                             duk_get_prop_index(ctx, -1, 0);
 
                             // TODO: class types
-                            variantType = (VariantType) duk_require_number(ctx, -1);
+                            variantType = (VariantType) ((int)duk_require_number(ctx, -1));
 
                             duk_pop(ctx);
                         }

+ 1 - 1
Source/AtomicJS/Javascript/JSScene.cpp

@@ -21,7 +21,7 @@ static int Node_CreateJSComponent(duk_context* ctx)
     String path = duk_require_string(ctx, 0);
 
     bool hasArgs = false;
-    int argIdx;
+    int argIdx = -1;
     if (duk_get_top(ctx) > 1 && duk_is_object(ctx, 1))
     {
         hasArgs = true;