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

Merge pull request #755 from AtomicGameEngine/JME-ATOMIC-WEBCAM

Enable WebCam on Windows also added ability to suppress D3DCompiler dll dependency
JoshEngebretson 9 лет назад
Родитель
Сommit
5b458578ab

+ 6 - 1
Build/CMake/Modules/AtomicWindows.cmake

@@ -29,10 +29,15 @@ else()
 
 endif()
 
+# removes dependency on D3DCompiler dll for Atomic Direct3D9 builds which don't require it
+# (binaries that never initialize the Direct3D9 graphics subsystem)
+if (NOT ATOMIC_D3DCOMPILER_DISABLE AND NOT ATOMIC_UWEBKIT)
+  add_definitions(-DATOMIC_D3DCOMPILER_ENABLED)
+endif()
 
 
 # compile with static runtime
-set(CompilerFlags CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE)
+set( CompilerFlags CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO )
 
 foreach(CompilerFlag ${CompilerFlags})
     string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")

+ 8 - 0
Source/Atomic/Graphics/Direct3D9/D3D9ShaderVariation.cpp

@@ -31,7 +31,10 @@
 #include "../../IO/Log.h"
 #include "../../Resource/ResourceCache.h"
 
+#ifdef ATOMIC_D3DCOMPILER_ENABLED
 #include <d3dcompiler.h>
+#endif
+
 #include <MojoShader/mojoshader.h>
 
 #include "../../DebugNew.h"
@@ -220,6 +223,10 @@ bool ShaderVariation::LoadByteCode(PODVector<unsigned>& byteCode, const String&
 
 bool ShaderVariation::Compile(PODVector<unsigned>& byteCode)
 {
+
+#ifndef ATOMIC_D3DCOMPILER_ENABLED
+    return false;
+#else
     const String& sourceCode = owner_->GetSourceCode(type_);
     Vector<String> defines = defines_.Split(' ');
 
@@ -306,6 +313,7 @@ bool ShaderVariation::Compile(PODVector<unsigned>& byteCode)
         errorMsgs->Release();
 
     return !byteCode.Empty();
+#endif
 }
 
 void ShaderVariation::ParseParameters(unsigned char* bufData, unsigned bufSize)

+ 3 - 0
Source/AtomicWebView/Internal/WebAppBrowser.cpp

@@ -35,6 +35,9 @@ WebAppBrowser::WebAppBrowser()
 
 void WebAppBrowser::OnBeforeCommandLineProcessing(const CefString& process_type, CefRefPtr<CefCommandLine> command_line)
 {
+    command_line->AppendSwitch("--enable-media-stream");
+    command_line->AppendSwitch("--enable-usermedia-screen-capturing");
+
     CefApp::OnBeforeCommandLineProcessing(process_type, command_line);
 }
 

+ 3 - 6
Source/AtomicWebView/WebBrowserHost.cpp

@@ -114,13 +114,10 @@ WebBrowserHost::WebBrowserHost(Context* context) : Object (context)
 #endif
 
 
-    // IMPORTANT: Cef::App contains virtual void OnBeforeCommandLineProcessing(), which should make it possible
-    // to setup args on Windows
+    // IMPORTANT: See flags being set in implementation of void WebAppBrowser::OnBeforeCommandLineProcessing
+    // these include "--enable-media-stream", "--enable-usermedia-screen-capturing"
 
-#ifdef ATOMIC_PLATFORM_OSX
-    const char* _argv[3] = { "", "--enable-media-stream", "--enable-usermedia-screen-capturing" };
-    CefMainArgs args(3, (char**) &_argv);
-#elif ATOMIC_PLATFORM_LINUX
+#ifdef ATOMIC_PLATFORM_LINUX
     static const char* _argv[3] = { "AtomicWebView", "--disable-setuid-sandbox", "--off-screen-rendering-enabled" };
     CefMainArgs args(3, (char**) &_argv);
 #else