diff --git a/Engine/lib/collada/include/dae.h b/Engine/lib/collada/include/dae.h index d6f217ed8..d5d16f125 100644 --- a/Engine/lib/collada/include/dae.h +++ b/Engine/lib/collada/include/dae.h @@ -195,7 +195,7 @@ private: daeRawRefCache rawRefCache; daeSidRefCache sidRefCache; - std::auto_ptr localCharEncoding; + std::unique_ptr localCharEncoding; static charEncoding globalCharEncoding; }; diff --git a/Engine/lib/collada/include/dae/daeErrorHandler.h b/Engine/lib/collada/include/dae/daeErrorHandler.h index 6d6499486..edc20ee31 100644 --- a/Engine/lib/collada/include/dae/daeErrorHandler.h +++ b/Engine/lib/collada/include/dae/daeErrorHandler.h @@ -60,7 +60,7 @@ public: private: static daeErrorHandler *_instance; - static std::auto_ptr _defaultInstance; + static std::unique_ptr _defaultInstance; }; #endif diff --git a/Engine/lib/collada/include/dae/daeStandardURIResolver.h b/Engine/lib/collada/include/dae/daeStandardURIResolver.h index 0c92bcc6e..6d9bcf15d 100644 --- a/Engine/lib/collada/include/dae/daeStandardURIResolver.h +++ b/Engine/lib/collada/include/dae/daeStandardURIResolver.h @@ -12,7 +12,7 @@ */ #ifndef __DAE_STANDARD_URI_RESOLVER__ -#define __DAE_STANDARD_URI_RESOVLER__ +#define __DAE_STANDARD_URI_RESOLVER__ #include #include "dae/daeURI.h" diff --git a/Engine/lib/collada/src/dae/daeErrorHandler.cpp b/Engine/lib/collada/src/dae/daeErrorHandler.cpp index 843bbbae3..2e7edcf9c 100644 --- a/Engine/lib/collada/src/dae/daeErrorHandler.cpp +++ b/Engine/lib/collada/src/dae/daeErrorHandler.cpp @@ -15,7 +15,7 @@ #include daeErrorHandler *daeErrorHandler::_instance = NULL; -std::auto_ptr daeErrorHandler::_defaultInstance(new stdErrPlugin); +std::unique_ptr daeErrorHandler::_defaultInstance(new stdErrPlugin); daeErrorHandler::daeErrorHandler() { } diff --git a/Engine/lib/glad/include/KHR/khrplatform.h b/Engine/lib/glad/include/KHR/khrplatform.h index 5b55ea2b9..dd22d9270 100644 --- a/Engine/lib/glad/include/KHR/khrplatform.h +++ b/Engine/lib/glad/include/KHR/khrplatform.h @@ -119,7 +119,7 @@ * This follows the return type of the function and precedes the function * name in the function prototype. */ -#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(KHRONOS_STATIC) +#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__) /* Win32 but not WinCE */ # define KHRONOS_APIENTRY __stdcall #else diff --git a/Engine/lib/glad/include/glad/glad_glx.h b/Engine/lib/glad/include/glad/glad_glx.h index 46abf2c5b..696366e44 100644 --- a/Engine/lib/glad/include/glad/glad_glx.h +++ b/Engine/lib/glad/include/glad/glad_glx.h @@ -1,6 +1,6 @@ /* - GLX loader generated by glad 0.1.33 on Sun Aug 18 11:26:39 2019. + GLX loader generated by glad 0.1.34 on Mon Oct 11 00:48:11 2021. Language/Generator: C/C++ Specification: glx @@ -27,6 +27,7 @@ GLX_EXT_create_context_es_profile, GLX_EXT_fbconfig_packed_float, GLX_EXT_framebuffer_sRGB, + GLX_EXT_get_drawable_type, GLX_EXT_import_context, GLX_EXT_libglvnd, GLX_EXT_no_config_context, @@ -48,6 +49,7 @@ GLX_NV_copy_image, GLX_NV_delay_before_swap, GLX_NV_float_buffer, + GLX_NV_multigpu_context, GLX_NV_multisample_coverage, GLX_NV_present_video, GLX_NV_robustness_video_memory_purge, @@ -79,7 +81,7 @@ Reproducible: False Commandline: - --api="glx=1.4" --generator="c" --spec="glx" --extensions="GLX_3DFX_multisample,GLX_AMD_gpu_association,GLX_ARB_context_flush_control,GLX_ARB_create_context,GLX_ARB_create_context_no_error,GLX_ARB_create_context_profile,GLX_ARB_create_context_robustness,GLX_ARB_fbconfig_float,GLX_ARB_framebuffer_sRGB,GLX_ARB_get_proc_address,GLX_ARB_multisample,GLX_ARB_robustness_application_isolation,GLX_ARB_robustness_share_group_isolation,GLX_ARB_vertex_buffer_object,GLX_EXT_buffer_age,GLX_EXT_context_priority,GLX_EXT_create_context_es2_profile,GLX_EXT_create_context_es_profile,GLX_EXT_fbconfig_packed_float,GLX_EXT_framebuffer_sRGB,GLX_EXT_import_context,GLX_EXT_libglvnd,GLX_EXT_no_config_context,GLX_EXT_stereo_tree,GLX_EXT_swap_control,GLX_EXT_swap_control_tear,GLX_EXT_texture_from_pixmap,GLX_EXT_visual_info,GLX_EXT_visual_rating,GLX_INTEL_swap_event,GLX_MESA_agp_offset,GLX_MESA_copy_sub_buffer,GLX_MESA_pixmap_colormap,GLX_MESA_query_renderer,GLX_MESA_release_buffers,GLX_MESA_set_3dfx_mode,GLX_MESA_swap_control,GLX_NV_copy_buffer,GLX_NV_copy_image,GLX_NV_delay_before_swap,GLX_NV_float_buffer,GLX_NV_multisample_coverage,GLX_NV_present_video,GLX_NV_robustness_video_memory_purge,GLX_NV_swap_group,GLX_NV_video_capture,GLX_NV_video_out,GLX_OML_swap_method,GLX_OML_sync_control,GLX_SGIS_blended_overlay,GLX_SGIS_multisample,GLX_SGIS_shared_multisample,GLX_SGIX_dmbuffer,GLX_SGIX_fbconfig,GLX_SGIX_hyperpipe,GLX_SGIX_pbuffer,GLX_SGIX_swap_barrier,GLX_SGIX_swap_group,GLX_SGIX_video_resize,GLX_SGIX_video_source,GLX_SGIX_visual_select_group,GLX_SGI_cushion,GLX_SGI_make_current_read,GLX_SGI_swap_control,GLX_SGI_video_sync,GLX_SUN_get_transparent_index" + --api="glx=1.4" --generator="c" --spec="glx" --extensions="GLX_3DFX_multisample,GLX_AMD_gpu_association,GLX_ARB_context_flush_control,GLX_ARB_create_context,GLX_ARB_create_context_no_error,GLX_ARB_create_context_profile,GLX_ARB_create_context_robustness,GLX_ARB_fbconfig_float,GLX_ARB_framebuffer_sRGB,GLX_ARB_get_proc_address,GLX_ARB_multisample,GLX_ARB_robustness_application_isolation,GLX_ARB_robustness_share_group_isolation,GLX_ARB_vertex_buffer_object,GLX_EXT_buffer_age,GLX_EXT_context_priority,GLX_EXT_create_context_es2_profile,GLX_EXT_create_context_es_profile,GLX_EXT_fbconfig_packed_float,GLX_EXT_framebuffer_sRGB,GLX_EXT_get_drawable_type,GLX_EXT_import_context,GLX_EXT_libglvnd,GLX_EXT_no_config_context,GLX_EXT_stereo_tree,GLX_EXT_swap_control,GLX_EXT_swap_control_tear,GLX_EXT_texture_from_pixmap,GLX_EXT_visual_info,GLX_EXT_visual_rating,GLX_INTEL_swap_event,GLX_MESA_agp_offset,GLX_MESA_copy_sub_buffer,GLX_MESA_pixmap_colormap,GLX_MESA_query_renderer,GLX_MESA_release_buffers,GLX_MESA_set_3dfx_mode,GLX_MESA_swap_control,GLX_NV_copy_buffer,GLX_NV_copy_image,GLX_NV_delay_before_swap,GLX_NV_float_buffer,GLX_NV_multigpu_context,GLX_NV_multisample_coverage,GLX_NV_present_video,GLX_NV_robustness_video_memory_purge,GLX_NV_swap_group,GLX_NV_video_capture,GLX_NV_video_out,GLX_OML_swap_method,GLX_OML_sync_control,GLX_SGIS_blended_overlay,GLX_SGIS_multisample,GLX_SGIS_shared_multisample,GLX_SGIX_dmbuffer,GLX_SGIX_fbconfig,GLX_SGIX_hyperpipe,GLX_SGIX_pbuffer,GLX_SGIX_swap_barrier,GLX_SGIX_swap_group,GLX_SGIX_video_resize,GLX_SGIX_video_source,GLX_SGIX_visual_select_group,GLX_SGI_cushion,GLX_SGI_make_current_read,GLX_SGI_swap_control,GLX_SGI_video_sync,GLX_SUN_get_transparent_index" Online: Too many extensions */ @@ -139,6 +141,7 @@ typedef void* (* GLADloadproc)(const char *name); #endif GLAPI int gladLoadGLX(Display *dpy, int screen); +GLAPI void gladUnloadGLX(void); GLAPI int gladLoadGLXLoader(GLADloadproc, Display *dpy, int screen); @@ -616,6 +619,11 @@ GLAPI PFNGLXGETPROCADDRESSPROC glad_glXGetProcAddress; #define GLX_3DFX_WINDOW_MODE_MESA 0x1 #define GLX_3DFX_FULLSCREEN_MODE_MESA 0x2 #define GLX_FLOAT_COMPONENTS_NV 0x20B0 +#define GLX_CONTEXT_MULTIGPU_ATTRIB_NV 0x20AA +#define GLX_CONTEXT_MULTIGPU_ATTRIB_SINGLE_NV 0x20AB +#define GLX_CONTEXT_MULTIGPU_ATTRIB_AFR_NV 0x20AC +#define GLX_CONTEXT_MULTIGPU_ATTRIB_MULTICAST_NV 0x20AD +#define GLX_CONTEXT_MULTIGPU_ATTRIB_MULTI_DISPLAY_MULTICAST_NV 0x20AE #define GLX_COVERAGE_SAMPLES_NV 100001 #define GLX_COLOR_SAMPLES_NV 0x20B3 #define GLX_NUM_VIDEO_SLOTS_NV 0x20F0 @@ -804,6 +812,10 @@ GLAPI int GLAD_GLX_EXT_fbconfig_packed_float; #define GLX_EXT_framebuffer_sRGB 1 GLAPI int GLAD_GLX_EXT_framebuffer_sRGB; #endif +#ifndef GLX_EXT_get_drawable_type +#define GLX_EXT_get_drawable_type 1 +GLAPI int GLAD_GLX_EXT_get_drawable_type; +#endif #ifndef GLX_EXT_import_context #define GLX_EXT_import_context 1 GLAPI int GLAD_GLX_EXT_import_context; @@ -957,6 +969,10 @@ GLAPI PFNGLXDELAYBEFORESWAPNVPROC glad_glXDelayBeforeSwapNV; #define GLX_NV_float_buffer 1 GLAPI int GLAD_GLX_NV_float_buffer; #endif +#ifndef GLX_NV_multigpu_context +#define GLX_NV_multigpu_context 1 +GLAPI int GLAD_GLX_NV_multigpu_context; +#endif #ifndef GLX_NV_multisample_coverage #define GLX_NV_multisample_coverage 1 GLAPI int GLAD_GLX_NV_multisample_coverage; diff --git a/Engine/lib/glad/src/glx/glad_glx.c b/Engine/lib/glad/src/glx/glad_glx.c index 0adb32bd6..69eeb3dd8 100644 --- a/Engine/lib/glad/src/glx/glad_glx.c +++ b/Engine/lib/glad/src/glx/glad_glx.c @@ -1,6 +1,6 @@ /* - GLX loader generated by glad 0.1.33 on Sun Aug 18 11:26:39 2019. + GLX loader generated by glad 0.1.34 on Mon Oct 11 00:48:11 2021. Language/Generator: C/C++ Specification: glx @@ -27,6 +27,7 @@ GLX_EXT_create_context_es_profile, GLX_EXT_fbconfig_packed_float, GLX_EXT_framebuffer_sRGB, + GLX_EXT_get_drawable_type, GLX_EXT_import_context, GLX_EXT_libglvnd, GLX_EXT_no_config_context, @@ -48,6 +49,7 @@ GLX_NV_copy_image, GLX_NV_delay_before_swap, GLX_NV_float_buffer, + GLX_NV_multigpu_context, GLX_NV_multisample_coverage, GLX_NV_present_video, GLX_NV_robustness_video_memory_purge, @@ -79,7 +81,7 @@ Reproducible: False Commandline: - --api="glx=1.4" --generator="c" --spec="glx" --extensions="GLX_3DFX_multisample,GLX_AMD_gpu_association,GLX_ARB_context_flush_control,GLX_ARB_create_context,GLX_ARB_create_context_no_error,GLX_ARB_create_context_profile,GLX_ARB_create_context_robustness,GLX_ARB_fbconfig_float,GLX_ARB_framebuffer_sRGB,GLX_ARB_get_proc_address,GLX_ARB_multisample,GLX_ARB_robustness_application_isolation,GLX_ARB_robustness_share_group_isolation,GLX_ARB_vertex_buffer_object,GLX_EXT_buffer_age,GLX_EXT_context_priority,GLX_EXT_create_context_es2_profile,GLX_EXT_create_context_es_profile,GLX_EXT_fbconfig_packed_float,GLX_EXT_framebuffer_sRGB,GLX_EXT_import_context,GLX_EXT_libglvnd,GLX_EXT_no_config_context,GLX_EXT_stereo_tree,GLX_EXT_swap_control,GLX_EXT_swap_control_tear,GLX_EXT_texture_from_pixmap,GLX_EXT_visual_info,GLX_EXT_visual_rating,GLX_INTEL_swap_event,GLX_MESA_agp_offset,GLX_MESA_copy_sub_buffer,GLX_MESA_pixmap_colormap,GLX_MESA_query_renderer,GLX_MESA_release_buffers,GLX_MESA_set_3dfx_mode,GLX_MESA_swap_control,GLX_NV_copy_buffer,GLX_NV_copy_image,GLX_NV_delay_before_swap,GLX_NV_float_buffer,GLX_NV_multisample_coverage,GLX_NV_present_video,GLX_NV_robustness_video_memory_purge,GLX_NV_swap_group,GLX_NV_video_capture,GLX_NV_video_out,GLX_OML_swap_method,GLX_OML_sync_control,GLX_SGIS_blended_overlay,GLX_SGIS_multisample,GLX_SGIS_shared_multisample,GLX_SGIX_dmbuffer,GLX_SGIX_fbconfig,GLX_SGIX_hyperpipe,GLX_SGIX_pbuffer,GLX_SGIX_swap_barrier,GLX_SGIX_swap_group,GLX_SGIX_video_resize,GLX_SGIX_video_source,GLX_SGIX_visual_select_group,GLX_SGI_cushion,GLX_SGI_make_current_read,GLX_SGI_swap_control,GLX_SGI_video_sync,GLX_SUN_get_transparent_index" + --api="glx=1.4" --generator="c" --spec="glx" --extensions="GLX_3DFX_multisample,GLX_AMD_gpu_association,GLX_ARB_context_flush_control,GLX_ARB_create_context,GLX_ARB_create_context_no_error,GLX_ARB_create_context_profile,GLX_ARB_create_context_robustness,GLX_ARB_fbconfig_float,GLX_ARB_framebuffer_sRGB,GLX_ARB_get_proc_address,GLX_ARB_multisample,GLX_ARB_robustness_application_isolation,GLX_ARB_robustness_share_group_isolation,GLX_ARB_vertex_buffer_object,GLX_EXT_buffer_age,GLX_EXT_context_priority,GLX_EXT_create_context_es2_profile,GLX_EXT_create_context_es_profile,GLX_EXT_fbconfig_packed_float,GLX_EXT_framebuffer_sRGB,GLX_EXT_get_drawable_type,GLX_EXT_import_context,GLX_EXT_libglvnd,GLX_EXT_no_config_context,GLX_EXT_stereo_tree,GLX_EXT_swap_control,GLX_EXT_swap_control_tear,GLX_EXT_texture_from_pixmap,GLX_EXT_visual_info,GLX_EXT_visual_rating,GLX_INTEL_swap_event,GLX_MESA_agp_offset,GLX_MESA_copy_sub_buffer,GLX_MESA_pixmap_colormap,GLX_MESA_query_renderer,GLX_MESA_release_buffers,GLX_MESA_set_3dfx_mode,GLX_MESA_swap_control,GLX_NV_copy_buffer,GLX_NV_copy_image,GLX_NV_delay_before_swap,GLX_NV_float_buffer,GLX_NV_multigpu_context,GLX_NV_multisample_coverage,GLX_NV_present_video,GLX_NV_robustness_video_memory_purge,GLX_NV_swap_group,GLX_NV_video_capture,GLX_NV_video_out,GLX_OML_swap_method,GLX_OML_sync_control,GLX_SGIS_blended_overlay,GLX_SGIS_multisample,GLX_SGIS_shared_multisample,GLX_SGIX_dmbuffer,GLX_SGIX_fbconfig,GLX_SGIX_hyperpipe,GLX_SGIX_pbuffer,GLX_SGIX_swap_barrier,GLX_SGIX_swap_group,GLX_SGIX_video_resize,GLX_SGIX_video_source,GLX_SGIX_visual_select_group,GLX_SGI_cushion,GLX_SGI_make_current_read,GLX_SGI_swap_control,GLX_SGI_video_sync,GLX_SUN_get_transparent_index" Online: Too many extensions */ @@ -119,7 +121,7 @@ static PFNWGLGETPROCADDRESSPROC_PRIVATE gladGetProcAddressPtr; #endif static -int open_gl(void) { +int open_glx(void) { #ifndef IS_UWP libGL = LoadLibraryW(L"opengl32.dll"); if(libGL != NULL) { @@ -134,7 +136,7 @@ int open_gl(void) { } static -void close_gl(void) { +void close_glx(void) { if(libGL != NULL) { FreeLibrary((HMODULE) libGL); libGL = NULL; @@ -150,7 +152,7 @@ static PFNGLXGETPROCADDRESSPROC_PRIVATE gladGetProcAddressPtr; #endif static -int open_gl(void) { +int open_glx(void) { #ifdef __APPLE__ static const char *NAMES[] = { "../Frameworks/OpenGL.framework/OpenGL", @@ -181,7 +183,7 @@ int open_gl(void) { } static -void close_gl(void) { +void close_glx(void) { if(libGL != NULL) { dlclose(libGL); libGL = NULL; @@ -213,14 +215,17 @@ void* get_proc(const char *namez) { int gladLoadGLX(Display *dpy, int screen) { int status = 0; - if(open_gl()) { + if(open_glx()) { status = gladLoadGLXLoader((GLADloadproc)get_proc, dpy, screen); - close_gl(); } return status; } +void gladUnloadGLX(void) { + close_glx(); +} + static Display *GLADGLXDisplay = 0; static int GLADGLXscreen = 0; @@ -326,6 +331,7 @@ int GLAD_GLX_EXT_create_context_es2_profile = 0; int GLAD_GLX_EXT_create_context_es_profile = 0; int GLAD_GLX_EXT_fbconfig_packed_float = 0; int GLAD_GLX_EXT_framebuffer_sRGB = 0; +int GLAD_GLX_EXT_get_drawable_type = 0; int GLAD_GLX_EXT_import_context = 0; int GLAD_GLX_EXT_libglvnd = 0; int GLAD_GLX_EXT_no_config_context = 0; @@ -347,6 +353,7 @@ int GLAD_GLX_NV_copy_buffer = 0; int GLAD_GLX_NV_copy_image = 0; int GLAD_GLX_NV_delay_before_swap = 0; int GLAD_GLX_NV_float_buffer = 0; +int GLAD_GLX_NV_multigpu_context = 0; int GLAD_GLX_NV_multisample_coverage = 0; int GLAD_GLX_NV_present_video = 0; int GLAD_GLX_NV_robustness_video_memory_purge = 0; @@ -752,6 +759,7 @@ static int find_extensionsGLX(void) { GLAD_GLX_EXT_create_context_es_profile = has_ext("GLX_EXT_create_context_es_profile"); GLAD_GLX_EXT_fbconfig_packed_float = has_ext("GLX_EXT_fbconfig_packed_float"); GLAD_GLX_EXT_framebuffer_sRGB = has_ext("GLX_EXT_framebuffer_sRGB"); + GLAD_GLX_EXT_get_drawable_type = has_ext("GLX_EXT_get_drawable_type"); GLAD_GLX_EXT_import_context = has_ext("GLX_EXT_import_context"); GLAD_GLX_EXT_libglvnd = has_ext("GLX_EXT_libglvnd"); GLAD_GLX_EXT_no_config_context = has_ext("GLX_EXT_no_config_context"); @@ -773,6 +781,7 @@ static int find_extensionsGLX(void) { GLAD_GLX_NV_copy_image = has_ext("GLX_NV_copy_image"); GLAD_GLX_NV_delay_before_swap = has_ext("GLX_NV_delay_before_swap"); GLAD_GLX_NV_float_buffer = has_ext("GLX_NV_float_buffer"); + GLAD_GLX_NV_multigpu_context = has_ext("GLX_NV_multigpu_context"); GLAD_GLX_NV_multisample_coverage = has_ext("GLX_NV_multisample_coverage"); GLAD_GLX_NV_present_video = has_ext("GLX_NV_present_video"); GLAD_GLX_NV_robustness_video_memory_purge = has_ext("GLX_NV_robustness_video_memory_purge"); diff --git a/Engine/source/T3D/assets/GUIAsset.cpp b/Engine/source/T3D/assets/GUIAsset.cpp index f9a2b500c..cacc3f9be 100644 --- a/Engine/source/T3D/assets/GUIAsset.cpp +++ b/Engine/source/T3D/assets/GUIAsset.cpp @@ -65,8 +65,6 @@ ConsoleSetType(TypeGUIAssetPtr) if (argc == 1) { // Yes, so fetch field value. - const char* pFieldValue = argv[0]; - *((const char**)dptr) = StringTable->insert(argv[0]); return; diff --git a/Engine/source/T3D/assets/ImageAsset.cpp b/Engine/source/T3D/assets/ImageAsset.cpp index 4376614ed..eb5f5036d 100644 --- a/Engine/source/T3D/assets/ImageAsset.cpp +++ b/Engine/source/T3D/assets/ImageAsset.cpp @@ -147,7 +147,7 @@ void ImageAsset::consoleInit() Con::addVariable("$Core::NoImageAssetFallback", TypeString, &smNoImageAssetFallback, "The assetId of the texture to display when the requested image asset is missing.\n" "@ingroup GFX\n"); - + smNoImageAssetFallback = StringTable->insert(Con::getVariable("$Core::NoImageAssetFallback")); } @@ -274,22 +274,8 @@ void ImageAsset::loadImage() mLoadedState = Ok; mIsValidImage = true; - return; - - //GFXTexHandle texture = getTexture(&GFXStaticTextureSRGBProfile); - - //mTexture.set(mImagePath, &GFXStaticTextureSRGBProfile, avar("%s() - mImage (line %d)", __FUNCTION__, __LINE__)); - - /*if (texture.isValid()) - { - mIsValidImage = true; - - //mBitmap = texture.getBitmap(); - - return; - }*/ - mChangeSignal.trigger(); + return; } mLoadedState = BadFileReference; @@ -497,8 +483,6 @@ GuiControl* GuiInspectorTypeImageAssetPtr::constructEditControl() mInspector->getInspectObject()->getIdString(), mCaption); mBrowseButton->setField("Command", szBuffer); - const char* id = mInspector->getInspectObject()->getIdString(); - setDataField(StringTable->insert("targetObject"), NULL, mInspector->getInspectObject()->getIdString()); // Create "Open in ShapeEditor" button @@ -569,7 +553,7 @@ bool GuiInspectorTypeImageAssetPtr::renderTooltip(const Point2I& hoverPos, const if (texture.isNull()) return false; - // Render image at a reasonable screen size while + // Render image at a reasonable screen size while // keeping its aspect ratio... Point2I screensize = getRoot()->getWindowSize(); Point2I offset = hoverPos; diff --git a/Engine/source/T3D/assets/MaterialAsset.cpp b/Engine/source/T3D/assets/MaterialAsset.cpp index 8fd2b6ecf..50e75ffa3 100644 --- a/Engine/source/T3D/assets/MaterialAsset.cpp +++ b/Engine/source/T3D/assets/MaterialAsset.cpp @@ -19,7 +19,6 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS // IN THE SOFTWARE. //----------------------------------------------------------------------------- -#pragma once #ifndef MATERIALASSET_H #include "MaterialAsset.h" @@ -168,13 +167,29 @@ void MaterialAsset::initializeAsset() mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath; + if (mMatDefinitionName == StringTable->EmptyString()) + { + mLoadedState = Failed; + return; + } + if (Torque::FS::IsScriptFile(mScriptPath)) { if (!Sim::findObject(mMatDefinitionName)) - if (Con::executeFile(mScriptPath, false, false)) - mLoadedState = ScriptLoaded; - else - mLoadedState = Failed; + { + if (Con::executeFile(mScriptPath, false, false)) + { + mLoadedState = ScriptLoaded; + } + else + { + mLoadedState = Failed; + } + } + else + { + mLoadedState = DefinitionAlreadyExists; + } } loadMaterial(); @@ -184,6 +199,12 @@ void MaterialAsset::onAssetRefresh() { mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath; + if (mMatDefinitionName == StringTable->EmptyString()) + { + mLoadedState = Failed; + return; + } + if (Torque::FS::IsScriptFile(mScriptPath)) { //Since we're refreshing, we can assume that the file we're executing WILL have an existing definition. @@ -199,7 +220,6 @@ void MaterialAsset::onAssetRefresh() //And now that we've executed, switch back to the prior behavior Con::setVariable("$Con::redefineBehavior", redefineBehaviorPrev.c_str()); - } loadMaterial(); @@ -227,7 +247,7 @@ void MaterialAsset::loadMaterial() if (mMaterialDefinition) SAFE_DELETE(mMaterialDefinition); - if (mLoadedState == ScriptLoaded && mMatDefinitionName != StringTable->EmptyString()) + if ((mLoadedState == ScriptLoaded || mLoadedState == DefinitionAlreadyExists) && mMatDefinitionName != StringTable->EmptyString()) { Material* matDef; if (!Sim::findObject(mMatDefinitionName, matDef)) diff --git a/Engine/source/T3D/assets/MaterialAsset.h b/Engine/source/T3D/assets/MaterialAsset.h index 9fab8a1da..a6dff23c8 100644 --- a/Engine/source/T3D/assets/MaterialAsset.h +++ b/Engine/source/T3D/assets/MaterialAsset.h @@ -74,6 +74,7 @@ public: enum MaterialAssetErrCode { ScriptLoaded = AssetErrCode::Extended, + DefinitionAlreadyExists, Extended }; diff --git a/Engine/source/T3D/assets/ScriptAsset.cpp b/Engine/source/T3D/assets/ScriptAsset.cpp index dad8ab1c6..199c6402c 100644 --- a/Engine/source/T3D/assets/ScriptAsset.cpp +++ b/Engine/source/T3D/assets/ScriptAsset.cpp @@ -190,17 +190,12 @@ bool ScriptAsset::execScript() if (handle) return true; - return false; - if (Torque::FS::IsScriptFile(mScriptPath)) { return Con::executeFile(mScriptPath, false, false); } - else - { - Con::errorf("ScriptAsset:execScript() - Script asset must have a valid file to exec"); - return false; - } + Con::errorf("ScriptAsset:execScript() - Script asset must have a valid file to exec"); + return false; } DefineEngineMethod(ScriptAsset, execScript, bool, (), , diff --git a/Engine/source/T3D/assets/ShapeAsset.cpp b/Engine/source/T3D/assets/ShapeAsset.cpp index bde3b4af5..7a8628238 100644 --- a/Engine/source/T3D/assets/ShapeAsset.cpp +++ b/Engine/source/T3D/assets/ShapeAsset.cpp @@ -603,8 +603,6 @@ GuiControl* GuiInspectorTypeShapeAssetPtr::constructEditControl() mInspector->getInspectObject()->getIdString(), mCaption); mBrowseButton->setField("Command", szBuffer); - const char* id = mInspector->getInspectObject()->getIdString(); - setDataField(StringTable->insert("targetObject"), NULL, mInspector->getInspectObject()->getIdString()); // Create "Open in ShapeEditor" button diff --git a/Engine/source/T3D/assets/TerrainAsset.cpp b/Engine/source/T3D/assets/TerrainAsset.cpp index da0372097..70ce8786b 100644 --- a/Engine/source/T3D/assets/TerrainAsset.cpp +++ b/Engine/source/T3D/assets/TerrainAsset.cpp @@ -468,8 +468,6 @@ GuiControl* GuiInspectorTypeTerrainAssetPtr::constructEditControl() mInspector->getInspectObject()->getIdString(), mCaption); mBrowseButton->setField("Command", szBuffer); - const char* id = mInspector->getInspectObject()->getIdString(); - setDataField(StringTable->insert("targetObject"), NULL, mInspector->getInspectObject()->getIdString()); // Create "Open in ShapeEditor" button diff --git a/Engine/source/T3D/assets/assetImporter.cpp b/Engine/source/T3D/assets/assetImporter.cpp index 254df381d..e9afcc479 100644 --- a/Engine/source/T3D/assets/assetImporter.cpp +++ b/Engine/source/T3D/assets/assetImporter.cpp @@ -1821,10 +1821,8 @@ void AssetImporter::processShapeAsset(AssetImportObject* assetItem) } S32 meshCount = dAtoi(assetItem->shapeInfo->getDataField(StringTable->insert("_meshCount"), nullptr)); - S32 shapeItem = assetItem->shapeInfo->findItemByName("Meshes"); S32 animCount = dAtoi(assetItem->shapeInfo->getDataField(StringTable->insert("_animCount"), nullptr)); - S32 animItem = assetItem->shapeInfo->findItemByName("Animations"); S32 materialCount = dAtoi(assetItem->shapeInfo->getDataField(StringTable->insert("_materialCount"), nullptr)); S32 matItem = assetItem->shapeInfo->findItemByName("Materials"); @@ -2005,9 +2003,7 @@ void AssetImporter::validateAsset(AssetImportObject* assetItem) if (assetItem->importStatus == AssetImportObject::Skipped || assetItem->importStatus == AssetImportObject::NotProcessed) return; - bool hasCollision = checkAssetForCollision(assetItem); - - if (hasCollision) + if (checkAssetForCollision(assetItem)) { importIssues = true; return; @@ -2018,7 +2014,6 @@ void AssetImporter::validateAsset(AssetImportObject* assetItem) AssetQuery aQuery; U32 numAssetsFound = AssetDatabase.findAllAssets(&aQuery); - hasCollision = false; for (U32 i = 0; i < numAssetsFound; i++) { StringTableEntry assetId = aQuery.mAssetList[i]; @@ -2032,7 +2027,6 @@ void AssetImporter::validateAsset(AssetImportObject* assetItem) if (assetName == StringTable->insert(assetItem->assetName.c_str())) { - hasCollision = true; assetItem->status = "Error"; assetItem->statusType = "DuplicateAsset"; assetItem->statusInfo = "Duplicate asset names found within the target module!\nAsset \"" + assetItem->assetName + "\" of type \"" + assetItem->assetType + "\" has a matching name.\nPlease rename it and try again!"; @@ -2241,7 +2235,6 @@ void AssetImporter::resetImportConfig() activeImportConfig->registerObject(); } - bool foundConfig = false; Settings* editorSettings; //See if we can get our editor settings if (Sim::findObject("EditorSettings", editorSettings)) diff --git a/Engine/source/T3D/assets/assetImporter.h b/Engine/source/T3D/assets/assetImporter.h index 0c176840a..b03c89c40 100644 --- a/Engine/source/T3D/assets/assetImporter.h +++ b/Engine/source/T3D/assets/assetImporter.h @@ -931,15 +931,6 @@ public: return imagePath; } - static inline const char* makeFullPath(const String& path) - { - char qualifiedFilePath[2048]; - - Platform::makeFullPathName(path.c_str(), qualifiedFilePath, sizeof(qualifiedFilePath)); - - return qualifiedFilePath; - } - // void setTargetModuleId(const String& moduleId) { targetModuleId = moduleId; } const String& getTargetModuleId() { return targetModuleId; } diff --git a/Engine/source/T3D/convexShape.cpp b/Engine/source/T3D/convexShape.cpp index 47271fd03..8cb8ae39f 100644 --- a/Engine/source/T3D/convexShape.cpp +++ b/Engine/source/T3D/convexShape.cpp @@ -222,7 +222,6 @@ bool ConvexShape::protectedSetSurface( void *object, const char *index, const ch */ String t = data; - S32 len = t.length(); dSscanf( data, "%g %g %g %g %g %g %g %i %g %g %g %g %f", &quat.x, &quat.y, &quat.z, &quat.w, &pos.x, &pos.y, &pos.z, &matID, &offset.x, &offset.y, &scale.x, &scale.y, &rot); @@ -318,10 +317,10 @@ void ConvexShape::initPersistFields() addGroup( "Internal" ); - addProtectedField( "surface", TypeRealString, NULL, &protectedSetSurface, &defaultProtectedGetFn, + addProtectedField( "surface", TypeRealString, 0, &protectedSetSurface, &defaultProtectedGetFn, "Do not modify, for internal use.", AbstractClassRep::FIELD_HideInInspectors ); - addProtectedField( "surfaceTexture", TypeRealString, NULL, &protectedSetSurfaceTexture, &defaultProtectedGetFn, + addProtectedField( "surfaceTexture", TypeRealString, 0, &protectedSetSurfaceTexture, &defaultProtectedGetFn, "Do not modify, for internal use.", AbstractClassRep::FIELD_HideInInspectors ); endGroup( "Internal" ); @@ -961,17 +960,6 @@ bool ConvexShape::castRay( const Point3F &start, const Point3F &end, RayInfo *in VectorF rayDir( end - start ); rayDir.normalizeSafe(); - if ( false ) - { - PlaneF plane( Point3F(0,0,0), Point3F(0,0,1) ); - Point3F sp( 0,0,-1 ); - Point3F ep( 0,0,1 ); - - F32 t = plane.intersect( sp, ep ); - Point3F hitPnt; - hitPnt.interpolate( sp, ep, t ); - } - for ( S32 i = 0; i < planeCount; i++ ) { // Don't hit the back-side of planes. @@ -1376,8 +1364,6 @@ void ConvexShape::_updateGeometry( bool updateCollision ) { U32 count = faceList[i].triangles.size(); - S32 matID = mSurfaceUVs[i].matID; - mSurfaceBuffers[mSurfaceUVs[i].matID].mPrimCount += count; mSurfaceBuffers[mSurfaceUVs[i].matID].mVertCount += count * 3; } @@ -1429,9 +1415,6 @@ void ConvexShape::_updateGeometry( bool updateCollision ) { if (mSurfaceBuffers[i].mVertCount > 0) { - U32 primCount = mSurfaceBuffers[i].mPrimCount; - U32 vertCount = mSurfaceBuffers[i].mVertCount; - mSurfaceBuffers[i].mVertexBuffer.set(GFX, mSurfaceBuffers[i].mVertCount, GFXBufferTypeStatic); VertexType *pVert = mSurfaceBuffers[i].mVertexBuffer.lock(); diff --git a/Engine/source/T3D/fx/particleEmitter.cpp b/Engine/source/T3D/fx/particleEmitter.cpp index 45acd1ecb..79d2e6f1d 100644 --- a/Engine/source/T3D/fx/particleEmitter.cpp +++ b/Engine/source/T3D/fx/particleEmitter.cpp @@ -1908,42 +1908,21 @@ void ParticleEmitter::copyToVB( const Point3F &camPos, const LinearColorF &ambie if (mDataBlock->reverseOrder) { - buffPtr += 4 * (n_parts - 1); - // do sorted-oriented particles - if (mDataBlock->sortParticles) - { - SortParticle* partPtr = orderedVector.address(); - for (U32 i = 0; i < n_parts - 1; i++, partPtr++, buffPtr -= 4) - setupRibbon(partPtr->p, partPtr++->p, partPtr--->p, camPos, ambientColor, buffPtr); - } - // do unsorted-oriented particles - else - { Particle* oldPtr = NULL; - for (Particle* partPtr = part_list_head.next; partPtr != NULL; partPtr = partPtr->next, buffPtr -= 4) { + for (Particle* partPtr = part_list_head.next; partPtr != NULL; partPtr = partPtr->next, buffPtr -= 4) + { setupRibbon(partPtr, partPtr->next, oldPtr, camPos, ambientColor, buffPtr); oldPtr = partPtr; } - } } else { - // do sorted-oriented particles - if (mDataBlock->sortParticles) - { - SortParticle* partPtr = orderedVector.address(); - for (U32 i = 0; i < n_parts - 1; i++, partPtr++, buffPtr += 4) - setupRibbon(partPtr->p, partPtr++->p, partPtr--->p, camPos, ambientColor, buffPtr); - } - // do unsorted-oriented particles - else - { Particle* oldPtr = NULL; - for (Particle* partPtr = part_list_head.next; partPtr != NULL; partPtr = partPtr->next, buffPtr += 4) { + for (Particle* partPtr = part_list_head.next; partPtr != NULL; partPtr = partPtr->next, buffPtr += 4) + { setupRibbon(partPtr, partPtr->next, oldPtr, camPos, ambientColor, buffPtr); oldPtr = partPtr; } - } } PROFILE_END(); } diff --git a/Engine/source/T3D/fx/precipitation.cpp b/Engine/source/T3D/fx/precipitation.cpp index 1de61e8e2..11b9f4b67 100644 --- a/Engine/source/T3D/fx/precipitation.cpp +++ b/Engine/source/T3D/fx/precipitation.cpp @@ -1003,7 +1003,7 @@ void Precipitation::initRenderObjects() // entire or a partially filled vb. mRainIB.set(GFX, mMaxVBDrops * 6, 0, GFXBufferTypeStatic); U16 *idxBuff; - mRainIB.lock(&idxBuff, NULL, NULL, NULL); + mRainIB.lock(&idxBuff, NULL, 0, 0); for( U32 i=0; i < mMaxVBDrops; i++ ) { // diff --git a/Engine/source/T3D/gameBase/gameConnection.cpp b/Engine/source/T3D/gameBase/gameConnection.cpp index 09cfa13cf..f759a03da 100644 --- a/Engine/source/T3D/gameBase/gameConnection.cpp +++ b/Engine/source/T3D/gameBase/gameConnection.cpp @@ -807,7 +807,7 @@ bool GameConnection::isValidControlCameraFov(F32 fov) return cObj->isValidCameraFov(fov); } - return NULL; + return false; } bool GameConnection::setControlCameraFov(F32 fov) diff --git a/Engine/source/T3D/lighting/IBLUtilities.cpp b/Engine/source/T3D/lighting/IBLUtilities.cpp index f3b7c477c..5cdf27acb 100644 --- a/Engine/source/T3D/lighting/IBLUtilities.cpp +++ b/Engine/source/T3D/lighting/IBLUtilities.cpp @@ -46,7 +46,6 @@ namespace IBLUtilities } GFXShaderConstBufferRef irrConsts = irrShader->allocConstBuffer(); - GFXShaderConstHandle* irrEnvMapSC = irrShader->getShaderConstHandle("$environmentMap"); GFXShaderConstHandle* irrFaceSC = irrShader->getShaderConstHandle("$face"); GFXStateBlockDesc desc; @@ -132,7 +131,6 @@ namespace IBLUtilities } GFXShaderConstBufferRef prefilterConsts = prefilterShader->allocConstBuffer(); - GFXShaderConstHandle* prefilterEnvMapSC = prefilterShader->getShaderConstHandle("$environmentMap"); GFXShaderConstHandle* prefilterFaceSC = prefilterShader->getShaderConstHandle("$face"); GFXShaderConstHandle* prefilterRoughnessSC = prefilterShader->getShaderConstHandle("$roughness"); GFXShaderConstHandle* prefilterMipSizeSC = prefilterShader->getShaderConstHandle("$mipSize"); diff --git a/Engine/source/T3D/shapeBase.h b/Engine/source/T3D/shapeBase.h index 1670a8230..920289385 100644 --- a/Engine/source/T3D/shapeBase.h +++ b/Engine/source/T3D/shapeBase.h @@ -117,7 +117,7 @@ class ShapeBaseConvex : public Convex Box3F box; public: - ShapeBaseConvex() :pShapeBase(NULL), transform(NULL), hullId(NULL), nodeTransform(0) { mType = ShapeBaseConvexType; } + ShapeBaseConvex() :pShapeBase(NULL), transform(NULL), hullId(0), nodeTransform(0) { mType = ShapeBaseConvexType; } ShapeBaseConvex(const ShapeBaseConvex& cv) { mObject = cv.mObject; pShapeBase = cv.pShapeBase; diff --git a/Engine/source/T3D/shapeImage.cpp b/Engine/source/T3D/shapeImage.cpp index 1563f3be5..ee5d62476 100644 --- a/Engine/source/T3D/shapeImage.cpp +++ b/Engine/source/T3D/shapeImage.cpp @@ -410,7 +410,6 @@ bool ShapeBaseImageData::preload(bool server, String &errorStr) { if (!Parent::preload(server, errorStr)) return false; - bool shapeError = false; // Resolve objects transmitted from server if (!server) { diff --git a/Engine/source/afx/util/afxAnimCurve.h b/Engine/source/afx/util/afxAnimCurve.h index 158203b44..6ed7dbfd0 100644 --- a/Engine/source/afx/util/afxAnimCurve.h +++ b/Engine/source/afx/util/afxAnimCurve.h @@ -56,7 +56,7 @@ class afxAnimCurve public: afxAnimCurve(); - ~afxAnimCurve(); + virtual ~afxAnimCurve(); void addKey( Point2F &v ); void addKey( F32 time, F32 value ); diff --git a/Engine/source/afx/util/afxCurveEval.h b/Engine/source/afx/util/afxCurveEval.h index 0a8765c19..d5c6853b9 100644 --- a/Engine/source/afx/util/afxCurveEval.h +++ b/Engine/source/afx/util/afxCurveEval.h @@ -32,6 +32,7 @@ class afxCurveEval { public: + virtual ~afxCurveEval() { } virtual Point2F evaluateCurve(Point2F& v0, Point2F& v1, F32 t)=0; virtual Point2F evaluateCurve(Point2F& v0, Point2F& v1, Point2F& t0, Point2F& t1, F32 t)=0; virtual Point2F evaluateCurveTangent(Point2F& v0, Point2F& v1, F32 t)=0; diff --git a/Engine/source/afx/xm/afxXM_WaveBase.h b/Engine/source/afx/xm/afxXM_WaveBase.h index f7dd26f31..e231ef2b8 100644 --- a/Engine/source/afx/xm/afxXM_WaveBase.h +++ b/Engine/source/afx/xm/afxXM_WaveBase.h @@ -81,6 +81,7 @@ public: class afxXM_WaveInterp { public: + virtual ~afxXM_WaveInterp() { } virtual void interpolate(F32 t, afxXM_Params& params)=0; virtual void pulse()=0; @@ -250,7 +251,7 @@ protected: public: /*C*/ afxXM_WaveBase(afxXM_WaveBaseData*, afxEffectWrapper*, afxXM_WaveInterp*); - /*D*/ ~afxXM_WaveBase(); + /*D*/ virtual ~afxXM_WaveBase(); virtual void updateParams(F32 dt, F32 elapsed, afxXM_Params& params); }; diff --git a/Engine/source/collision/optimizedPolyList.h b/Engine/source/collision/optimizedPolyList.h index b66cc76c0..b42469fe1 100644 --- a/Engine/source/collision/optimizedPolyList.h +++ b/Engine/source/collision/optimizedPolyList.h @@ -87,7 +87,7 @@ class OptimizedPolyList : public AbstractPolyList Poly() : plane( -1 ), - material( NULL ), + material( 0 ), vertexStart(0), vertexCount( 0 ), surfaceKey(0), diff --git a/Engine/source/collision/polytope.h b/Engine/source/collision/polytope.h index 347a85c70..34483c976 100644 --- a/Engine/source/collision/polytope.h +++ b/Engine/source/collision/polytope.h @@ -76,7 +76,7 @@ public: Collision() { object = NULL; - material = NULL; + material = 0; distance = 0.0; } }; diff --git a/Engine/source/console/CMDscan.cpp b/Engine/source/console/CMDscan.cpp index 43a864570..787b4e845 100644 --- a/Engine/source/console/CMDscan.cpp +++ b/Engine/source/console/CMDscan.cpp @@ -774,9 +774,9 @@ YY_MALLOC_DECL YY_DECL { - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; + yy_state_type yy_current_state; + char *yy_cp, *yy_bp; + int yy_act; #line 105 "CMDscan.l" @@ -823,7 +823,7 @@ YY_DECL yy_match: do { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; @@ -1430,9 +1430,9 @@ case YY_STATE_EOF(INITIAL): static int yy_get_next_buffer() { - register char *dest = yy_current_buffer->yy_ch_buf; - register char *source = yytext_ptr; - register int number_to_move, i; + char *dest = yy_current_buffer->yy_ch_buf; + char *source = yytext_ptr; + int number_to_move, i; int ret_val; if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) @@ -1560,14 +1560,14 @@ static int yy_get_next_buffer() static yy_state_type yy_get_previous_state() { - register yy_state_type yy_current_state; - register char *yy_cp; + yy_state_type yy_current_state; + char *yy_cp; yy_current_state = yy_start; for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; @@ -1599,10 +1599,10 @@ static yy_state_type yy_try_NUL_trans( yy_current_state ) yy_state_type yy_current_state; #endif { - register int yy_is_jam; - register char *yy_cp = yy_c_buf_p; + int yy_is_jam; + char *yy_cp = yy_c_buf_p; - register YY_CHAR yy_c = 1; + YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; @@ -1623,14 +1623,14 @@ yy_state_type yy_current_state; #ifndef YY_NO_UNPUT #ifdef YY_USE_PROTOS -static void yyunput( int c, register char *yy_bp ) +static void yyunput( int c, char *yy_bp ) #else static void yyunput( c, yy_bp ) int c; -register char *yy_bp; +char *yy_bp; #endif { - register char *yy_cp = yy_c_buf_p; + char *yy_cp = yy_c_buf_p; /* undo effects of setting up yytext */ *yy_cp = yy_hold_char; @@ -1638,10 +1638,10 @@ register char *yy_bp; if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ - register int number_to_move = yy_n_chars + 2; - register char *dest = &yy_current_buffer->yy_ch_buf[ + int number_to_move = yy_n_chars + 2; + char *dest = &yy_current_buffer->yy_ch_buf[ yy_current_buffer->yy_buf_size + 2]; - register char *source = + char *source = &yy_current_buffer->yy_ch_buf[number_to_move]; while ( source > yy_current_buffer->yy_ch_buf ) @@ -2095,7 +2095,7 @@ yyconst char *s2; int n; #endif { - register int i; + int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } diff --git a/Engine/source/console/SimXMLDocument.cpp b/Engine/source/console/SimXMLDocument.cpp index 9f0bd4ff4..6e0de4c19 100644 --- a/Engine/source/console/SimXMLDocument.cpp +++ b/Engine/source/console/SimXMLDocument.cpp @@ -827,7 +827,6 @@ void SimXMLDocument::setObjectAttributes(const char* objectID) char textbuf[1024]; tinyxml2::XMLElement* field = m_qDocument->NewElement("Field"); - tinyxml2::XMLElement* group = m_qDocument->NewElement("FieldGroup"); pElement->SetAttribute( "Name", pObject->getName() ); diff --git a/Engine/source/console/arrayObject.cpp b/Engine/source/console/arrayObject.cpp index 68b34059e..4c18ac306 100644 --- a/Engine/source/console/arrayObject.cpp +++ b/Engine/source/console/arrayObject.cpp @@ -125,7 +125,7 @@ S32 QSORT_CALLBACK ArrayObject::_valueFunctionCompare( const void* a, const void ArrayObject::ArrayObject() : mCaseSensitive( false ), - mCurrentIndex( NULL ) + mCurrentIndex( 0 ) { } @@ -137,7 +137,7 @@ void ArrayObject::initPersistFields() "Makes the keys and values case-sensitive.\n" "By default, comparison of key and value strings will be case-insensitive." ); - addProtectedField( "key", TypeCaseString, NULL, &_addKeyFromField, &emptyStringProtectedGetFn, + addProtectedField( "key", TypeCaseString, 0, &_addKeyFromField, &emptyStringProtectedGetFn, "Helper field which allows you to add new key['keyname'] = value pairs." ); Parent::initPersistFields(); diff --git a/Engine/source/console/astNodes.cpp b/Engine/source/console/astNodes.cpp index aaca1ea06..c34c4b38d 100644 --- a/Engine/source/console/astNodes.cpp +++ b/Engine/source/console/astNodes.cpp @@ -74,7 +74,7 @@ void StmtNode::addBreakLine(CodeStream& code) //------------------------------------------------------------ -StmtNode::StmtNode() +StmtNode::StmtNode() : dbgLineNumber(0) { next = NULL; dbgFileName = CodeBlock::smCurrentParser->getCurrentFile(); @@ -84,12 +84,12 @@ void StmtNode::setPackage(StringTableEntry) { } -void StmtNode::append(StmtNode* next) +void StmtNode::append(StmtNode* appended) { StmtNode* walk = this; while (walk->next) walk = walk->next; - walk->next = next; + walk->next = appended; } diff --git a/Engine/source/console/compiledEval.cpp b/Engine/source/console/compiledEval.cpp index 360c13c90..e9862c7ee 100644 --- a/Engine/source/console/compiledEval.cpp +++ b/Engine/source/console/compiledEval.cpp @@ -717,7 +717,7 @@ ConsoleValue CodeBlock::exec(U32 ip, const char* functionName, Namespace* thisNa TelDebugger->pushStackFrame(); StringTableEntry var, objParent; - U32 failJump; + U32 failJump = 0; StringTableEntry fnName; StringTableEntry fnNamespace, fnPackage; @@ -776,7 +776,6 @@ ConsoleValue CodeBlock::exec(U32 ip, const char* functionName, Namespace* thisNa fnNamespace = CodeToSTE(code, ip + 2); fnPackage = CodeToSTE(code, ip + 4); bool hasBody = (code[ip + 6] & 0x01) != 0; - U32 lineNumber = code[ip + 6] >> 1; Namespace::unlinkPackages(); if (fnNamespace == NULL && fnPackage == NULL) @@ -1819,8 +1818,6 @@ ConsoleValue CodeBlock::exec(U32 ip, const char* functionName, Namespace* thisNa // it handles this method. It is set to an enum from the table // above indicating whether it handles it on a component it owns // or just on the object. - S32 routingId = 0; - fnName = CodeToSTE(code, ip); fnNamespace = CodeToSTE(code, ip + 2); U32 callType = code[ip + 4]; diff --git a/Engine/source/console/simObject.cpp b/Engine/source/console/simObject.cpp index 6b54bdd1d..3d485354c 100644 --- a/Engine/source/console/simObject.cpp +++ b/Engine/source/console/simObject.cpp @@ -179,10 +179,10 @@ void SimObject::initPersistFields() addGroup( "Editing" ); - addProtectedField( "hidden", TypeBool, NULL, + addProtectedField( "hidden", TypeBool, 0, &_setHidden, &_getHidden, "Whether the object is visible." ); - addProtectedField( "locked", TypeBool, NULL, + addProtectedField( "locked", TypeBool, 0, &_setLocked, &_getLocked, "Whether the object can be edited." ); diff --git a/Engine/source/console/test/ScriptTest.cpp b/Engine/source/console/test/ScriptTest.cpp index 05775694f..05f0582ff 100644 --- a/Engine/source/console/test/ScriptTest.cpp +++ b/Engine/source/console/test/ScriptTest.cpp @@ -889,6 +889,40 @@ TEST(Script, InnerObjectTests) ASSERT_EQ(nestedFuncCall.getInt(), 123); } +TEST(Script, MiscTesting) +{ + ConsoleValue test1 = RunScript(R"( + function testNotPassedInParameters(%a, %b, %c, %d) + { + if (%d $= "") + return true; + return false; + } + + return testNotPassedInParameters(1, 2); // skip passing in %c and %d + )"); + + ASSERT_EQ(test1.getBool(), true); + + ConsoleValue test2 = RunScript(R"( + function SimObject::concatNameTest(%this) + { + return true; + } + + new SimObject(WeirdTestObject1); + + function testObjectNameConcatination(%i) + { + return (WeirdTestObject @ %i).concatNameTest(); + } + + return testObjectNameConcatination(1); + )"); + + ASSERT_EQ(test2.getBool(), true); +} + TEST(Script, MiscRegressions) { ConsoleValue regression1 = RunScript(R"( diff --git a/Engine/source/core/stringBuffer.cpp b/Engine/source/core/stringBuffer.cpp index 2bc3fb069..66983fcf2 100644 --- a/Engine/source/core/stringBuffer.cpp +++ b/Engine/source/core/stringBuffer.cpp @@ -371,7 +371,7 @@ void StringBuffer::getCopy(UTF16 *buff, const U32 buffSize) const AssertFatal(mBuffer.last() == 0, "StringBuffer::get UTF8 - not a null terminated string!"); dMemcpy(buff, mBuffer.address(), sizeof(UTF16) * getMin(buffSize, (U32)mBuffer.size())); // ensure null termination. - buff[buffSize-1] = NULL; + buff[buffSize-1] = 0; } UTF8* StringBuffer::createCopy8() const diff --git a/Engine/source/core/strings/unicode.cpp b/Engine/source/core/strings/unicode.cpp index fd2341b7b..ad43ad3e1 100644 --- a/Engine/source/core/strings/unicode.cpp +++ b/Engine/source/core/strings/unicode.cpp @@ -236,8 +236,8 @@ U32 convertUTF16toUTF8DoubleNULL( const UTF16 *unistring, UTF8 *outbuffer, U32 } nCodeunits = getMin(nCodeunits,len - 1); - outbuffer[nCodeunits] = NULL; - outbuffer[nCodeunits+1] = NULL; + outbuffer[nCodeunits] = '\0'; + outbuffer[nCodeunits+1] = '\0'; PROFILE_END(); return nCodeunits; diff --git a/Engine/source/core/util/endian.h b/Engine/source/core/util/endian.h index 566f8be54..eaff3c03c 100644 --- a/Engine/source/core/util/endian.h +++ b/Engine/source/core/util/endian.h @@ -48,8 +48,12 @@ Convert the byte ordering on the U16 to and from big/little endian format. inline U16 endianSwap(const U16 in_swap) { +#ifdef TORQUE_U16_ENDIANSWAP_BUILTIN + return TORQUE_U16_ENDIANSWAP_BUILTIN(in_swap); +#else return U16(((in_swap >> 8) & 0x00ff) | ((in_swap << 8) & 0xff00)); +#endif } inline S16 endianSwap(const S16 in_swap) @@ -64,10 +68,14 @@ Convert the byte ordering on the U32 to and from big/little endian format. */ inline U32 endianSwap(const U32 in_swap) { +#ifdef TORQUE_U32_ENDIANSWAP_BUILTIN + return TORQUE_U32_ENDIANSWAP_BUILTIN(in_swap); +#else return U32(((in_swap >> 24) & 0x000000ff) | ((in_swap >> 8) & 0x0000ff00) | ((in_swap << 8) & 0x00ff0000) | ((in_swap << 24) & 0xff000000)); +#endif } inline S32 endianSwap(const S32 in_swap) @@ -77,12 +85,16 @@ inline S32 endianSwap(const S32 in_swap) inline U64 endianSwap(const U64 in_swap) { +#ifdef TORQUE_U64_ENDIANSWAP_BUILTIN + return TORQUE_U64_ENDIANSWAP_BUILTIN(in_swap); +#else U32 *inp = (U32 *) &in_swap; U64 ret; U32 *outp = (U32 *) &ret; outp[0] = endianSwap(inp[1]); outp[1] = endianSwap(inp[0]); return ret; +#endif } inline S64 endianSwap(const S64 in_swap) @@ -138,4 +150,3 @@ TORQUE_DECLARE_TEMPLATIZED_ENDIAN_CONV(F32) TORQUE_DECLARE_TEMPLATIZED_ENDIAN_CONV(F64) #endif - diff --git a/Engine/source/core/util/hashFunction.h b/Engine/source/core/util/hashFunction.h index d2e1d5b4a..02ecd019b 100644 --- a/Engine/source/core/util/hashFunction.h +++ b/Engine/source/core/util/hashFunction.h @@ -30,9 +30,9 @@ namespace Torque { -extern U32 hash(register const U8 *k, register U32 length, register U32 initval); +extern U32 hash(const U8 *k, U32 length, U32 initval); -extern U64 hash64(register const U8 *k, register U32 length, register U64 initval); +extern U64 hash64(const U8 *k, U32 length, U64 initval); } diff --git a/Engine/source/environment/cloudLayer.cpp b/Engine/source/environment/cloudLayer.cpp index dce8f84a2..0bc5b5944 100644 --- a/Engine/source/environment/cloudLayer.cpp +++ b/Engine/source/environment/cloudLayer.cpp @@ -278,7 +278,6 @@ void CloudLayer::unpackUpdate( NetConnection *conn, BitStream *stream ) stream->read( &mBaseColor ); - F32 oldCoverage = mCoverage; stream->read( &mCoverage ); stream->read( &mExposure ); diff --git a/Engine/source/environment/decalRoad.cpp b/Engine/source/environment/decalRoad.cpp index bd5e1e619..fb226507a 100644 --- a/Engine/source/environment/decalRoad.cpp +++ b/Engine/source/environment/decalRoad.cpp @@ -320,7 +320,7 @@ void DecalRoad::initPersistFields() addGroup( "Internal" ); - addProtectedField( "node", TypeString, NULL, &addNodeFromField, &emptyStringProtectedGetFn, + addProtectedField( "node", TypeString, 0, &addNodeFromField, &emptyStringProtectedGetFn, "Do not modify, for internal use." ); endGroup( "Internal" ); diff --git a/Engine/source/environment/editors/guiMeshRoadEditorCtrl.cpp b/Engine/source/environment/editors/guiMeshRoadEditorCtrl.cpp index 7d139c2ea..69963cec5 100644 --- a/Engine/source/environment/editors/guiMeshRoadEditorCtrl.cpp +++ b/Engine/source/environment/editors/guiMeshRoadEditorCtrl.cpp @@ -1757,7 +1757,7 @@ DefineEngineMethod( GuiMeshRoadEditorCtrl, getSelectedRoad, S32, (), , "" ) { MeshRoad *road = object->getSelectedRoad(); if ( !road ) - return NULL; + return 0; return road->getId(); } diff --git a/Engine/source/environment/editors/guiRiverEditorCtrl.cpp b/Engine/source/environment/editors/guiRiverEditorCtrl.cpp index e650fdf59..983c8a01e 100644 --- a/Engine/source/environment/editors/guiRiverEditorCtrl.cpp +++ b/Engine/source/environment/editors/guiRiverEditorCtrl.cpp @@ -1472,7 +1472,7 @@ DefineEngineMethod( GuiRiverEditorCtrl, getSelectedRiver, S32, (), , "" ) { River *river = object->getSelectedRiver(); if ( !river ) - return NULL; + return 0; return river->getId(); } diff --git a/Engine/source/environment/editors/guiRoadEditorCtrl.cpp b/Engine/source/environment/editors/guiRoadEditorCtrl.cpp index 3f111a80e..67b6ef883 100644 --- a/Engine/source/environment/editors/guiRoadEditorCtrl.cpp +++ b/Engine/source/environment/editors/guiRoadEditorCtrl.cpp @@ -1097,7 +1097,7 @@ DefineEngineMethod( GuiRoadEditorCtrl, getSelectedRoad, S32, (), , "" ) if ( road ) return road->getId(); - return NULL; + return 0; } DefineEngineMethod( GuiRoadEditorCtrl, getSelectedNode, S32, (), , "" ) diff --git a/Engine/source/environment/meshRoad.cpp b/Engine/source/environment/meshRoad.cpp index d3f143d88..2413198a8 100644 --- a/Engine/source/environment/meshRoad.cpp +++ b/Engine/source/environment/meshRoad.cpp @@ -954,10 +954,10 @@ void MeshRoad::initPersistFields() addGroup( "Internal" ); - addProtectedField( "Node", TypeString, NULL, &addNodeFromField, &emptyStringProtectedGetFn, + addProtectedField( "Node", TypeString, 0, &addNodeFromField, &emptyStringProtectedGetFn, "Do not modify, for internal use." ); - addProtectedField( "ProfileNode", TypeString, NULL, &addProfileNodeFromField, &emptyStringProtectedGetFn, + addProtectedField( "ProfileNode", TypeString, 0, &addProfileNodeFromField, &emptyStringProtectedGetFn, "Do not modify, for internal use." ); endGroup( "Internal" ); @@ -2896,7 +2896,6 @@ void MeshRoad::_generateVerts() // Make Primitive Buffers U32 p00, p01, p11, p10; - U32 pb00, pb01, pb11, pb10; U32 offset = 0; U16 *pIdx = NULL; U32 curIdx = 0; diff --git a/Engine/source/environment/river.cpp b/Engine/source/environment/river.cpp index 9bb1d7aac..0213f9d1d 100644 --- a/Engine/source/environment/river.cpp +++ b/Engine/source/environment/river.cpp @@ -647,7 +647,7 @@ void River::initPersistFields() addGroup( "Internal" ); - addProtectedField( "Node", TypeString, NULL, &addNodeFromField, &emptyStringProtectedGetFn, "For internal use, do not modify." ); + addProtectedField( "Node", TypeString, 0, &addNodeFromField, &emptyStringProtectedGetFn, "For internal use, do not modify." ); endGroup( "Internal" ); diff --git a/Engine/source/forest/forestItem.cpp b/Engine/source/forest/forestItem.cpp index 26624abb9..e9cdbc7c0 100644 --- a/Engine/source/forest/forestItem.cpp +++ b/Engine/source/forest/forestItem.cpp @@ -190,8 +190,6 @@ void ForestItemData::unpackData(BitStream* stream) stream->read( &localName ); setInternalName( localName ); - char readBuffer[1024]; - UNPACKDATA_ASSET(Shape); mCollidable = stream->readFlag(); diff --git a/Engine/source/gfx/D3D11/gfxD3D11Cubemap.cpp b/Engine/source/gfx/D3D11/gfxD3D11Cubemap.cpp index 562ab7b63..ed10be7bd 100644 --- a/Engine/source/gfx/D3D11/gfxD3D11Cubemap.cpp +++ b/Engine/source/gfx/D3D11/gfxD3D11Cubemap.cpp @@ -528,9 +528,6 @@ void GFXD3D11CubemapArray::init(const U32 cubemapCount, const U32 cubemapFaceSiz void GFXD3D11CubemapArray::updateTexture(const GFXCubemapHandle &cubemap, const U32 slot) { - U32 cubeMapSz = cubemap->getSize(); - U32 cubeMapSize = cubemap->getMipMapLevels(); - AssertFatal(slot <= mNumCubemaps, "GFXD3D11CubemapArray::updateTexture - trying to update a cubemap texture that is out of bounds!"); AssertFatal(mFormat == cubemap->getFormat(), "GFXD3D11CubemapArray::updateTexture - Destination format doesn't match"); AssertFatal(mSize == cubemap->getSize(), "GFXD3D11CubemapArray::updateTexture - Destination size doesn't match"); diff --git a/Engine/source/gfx/bitmap/gBitmap.cpp b/Engine/source/gfx/bitmap/gBitmap.cpp index 9560586dd..b7045d129 100644 --- a/Engine/source/gfx/bitmap/gBitmap.cpp +++ b/Engine/source/gfx/bitmap/gBitmap.cpp @@ -1199,7 +1199,7 @@ bool GBitmap::readBitmap( const String &bmType, Stream &ioStream ) if ( regInfo == NULL ) { Con::errorf( "[GBitmap::readBitmap] unable to find registration for extension [%s]", bmType.c_str() ); - return NULL; + return false; } return regInfo->readFunc( ioStream, this ); @@ -1212,7 +1212,7 @@ bool GBitmap::writeBitmap( const String &bmType, Stream &ioStream, U32 compress if ( regInfo == NULL ) { Con::errorf( "[GBitmap::writeBitmap] unable to find registration for extension [%s]", bmType.c_str() ); - return NULL; + return false; } return regInfo->writeFunc( this, ioStream, (compressionLevel == U32_MAX) ? regInfo->defaultCompression : compressionLevel ); diff --git a/Engine/source/gfx/bitmap/loaders/bitmapPng.cpp b/Engine/source/gfx/bitmap/loaders/bitmapPng.cpp index 65586caa8..9eb1d7b2c 100644 --- a/Engine/source/gfx/bitmap/loaders/bitmapPng.cpp +++ b/Engine/source/gfx/bitmap/loaders/bitmapPng.cpp @@ -143,7 +143,7 @@ static bool sReadPNG(Stream &stream, GBitmap *bitmap) stream.read(cs_headerBytesChecked, header); bool isPng = png_check_sig(header, cs_headerBytesChecked) != 0; - if (isPng == false) + if (!isPng) { AssertWarn(false, "GBitmap::readPNG: stream doesn't contain a PNG"); return false; diff --git a/Engine/source/gfx/gl/gfxGLCubemap.cpp b/Engine/source/gfx/gl/gfxGLCubemap.cpp index 99f3f02a8..db23a0fc2 100644 --- a/Engine/source/gfx/gl/gfxGLCubemap.cpp +++ b/Engine/source/gfx/gl/gfxGLCubemap.cpp @@ -308,7 +308,7 @@ U8* GFXGLCubemap::getTextureData(U32 face, U32 mip) GFXGLCubemapArray::GFXGLCubemapArray() { - mCubemap = NULL; + mCubemap = 0; } GFXGLCubemapArray::~GFXGLCubemapArray() diff --git a/Engine/source/gfx/gl/gfxGLDevice.cpp b/Engine/source/gfx/gl/gfxGLDevice.cpp index 1c82b4e74..1cba42143 100644 --- a/Engine/source/gfx/gl/gfxGLDevice.cpp +++ b/Engine/source/gfx/gl/gfxGLDevice.cpp @@ -51,6 +51,12 @@ #include "shaderGen/shaderGen.h" #include "gfxGLUtils.h" +#if defined(TORQUE_OS_WIN) +#include "gfx/gl/tGL/tWGL.h" +#elif defined(TORQUE_OS_LINUX) +#include "gfx/gl/tGL/tXGL.h" +#endif + GFXAdapter::CreateDeviceInstanceDelegate GFXGLDevice::mCreateDeviceInstance(GFXGLDevice::createInstance); GFXDevice *GFXGLDevice::createInstance( U32 adapterIndex ) @@ -1073,8 +1079,36 @@ U32 GFXGLDevice::getTotalVideoMemory_GL_EXT() return mem / 1024; } - // TODO OPENGL, add supprt for INTEL cards. - + +#if defined(TORQUE_OS_WIN) + else if( (gglHasWExtension(AMD_gpu_association)) ) + { + // Just assume 1 AMD gpu. Who uses crossfire anyways now? And, crossfire doesn't double + // vram anyways, so does it really matter? + UINT id; + if (wglGetGPUIDsAMD(1, &id) != 0) + { + S32 memorySize; + if (wglGetGPUInfoAMD(id, WGL_GPU_RAM_AMD, GL_INT, 1, &memorySize) != -1) + { + // memory size is returned in MB + return memorySize; + } + } + } +#endif + +#if defined(TORQUE_OS_LINUX) + else if ( (gglHasXExtension(NULL, NULL, MESA_query_renderer)) ) + { + // memory size is in mb + U32 memorySize; + glXQueryCurrentRendererIntegerMESA(GLX_RENDERER_VIDEO_MEMORY_MESA, &memorySize); + return memorySize; + } +#endif + + // No other way, sad. Probably windows Intel. return 0; } diff --git a/Engine/source/gfx/gl/gfxGLShader.cpp b/Engine/source/gfx/gl/gfxGLShader.cpp index ce8e7c855..8595a96d4 100644 --- a/Engine/source/gfx/gl/gfxGLShader.cpp +++ b/Engine/source/gfx/gl/gfxGLShader.cpp @@ -562,6 +562,7 @@ void GFXGLShader::initConstantDescs() if(!maxNameLength) return; + maxNameLength++; FrameTemp uniformName(maxNameLength); diff --git a/Engine/source/gfx/gl/gfxGLStateBlock.cpp b/Engine/source/gfx/gl/gfxGLStateBlock.cpp index 5be2e43d5..12eab71b0 100644 --- a/Engine/source/gfx/gl/gfxGLStateBlock.cpp +++ b/Engine/source/gfx/gl/gfxGLStateBlock.cpp @@ -101,8 +101,8 @@ void GFXGLStateBlock::activate(const GFXGLStateBlock* oldState) // the state value even if that value is identical to the current value. #define STATE_CHANGE(state) (!oldState || oldState->mDesc.state != mDesc.state) -#define TOGGLE_STATE(state, enum) if(mDesc.state) glEnable(enum); else glDisable(enum) -#define CHECK_TOGGLE_STATE(state, enum) if(!oldState || oldState->mDesc.state != mDesc.state) if(mDesc.state) glEnable(enum); else glDisable(enum) +#define TOGGLE_STATE(state, enum) if(mDesc.state) { glEnable(enum); } else { glDisable(enum); } +#define CHECK_TOGGLE_STATE(state, enum) if(!oldState || oldState->mDesc.state != mDesc.state) { if(mDesc.state) { glEnable(enum); } else { glDisable(enum); }} // Blending CHECK_TOGGLE_STATE(blendEnable, GL_BLEND); diff --git a/Engine/source/gfx/gl/gfxGLTextureArray.cpp b/Engine/source/gfx/gl/gfxGLTextureArray.cpp index f2b403bb0..e0137a448 100644 --- a/Engine/source/gfx/gl/gfxGLTextureArray.cpp +++ b/Engine/source/gfx/gl/gfxGLTextureArray.cpp @@ -6,7 +6,7 @@ GFXGLTextureArray::GFXGLTextureArray() { - mTextureArray = NULL; + mTextureArray = 0; } void GFXGLTextureArray::init() diff --git a/Engine/source/gfx/gl/gfxGLTextureArray.h b/Engine/source/gfx/gl/gfxGLTextureArray.h index 65e1d9729..7073b1653 100644 --- a/Engine/source/gfx/gl/gfxGLTextureArray.h +++ b/Engine/source/gfx/gl/gfxGLTextureArray.h @@ -13,7 +13,7 @@ public: ~GFXGLTextureArray() { Release(); }; - void init(); + void init() override; void setToTexUnit(U32 tuNum) override; diff --git a/Engine/source/gfx/gl/gfxGLTextureObject.cpp b/Engine/source/gfx/gl/gfxGLTextureObject.cpp index 9eabc8114..1d5c043e4 100644 --- a/Engine/source/gfx/gl/gfxGLTextureObject.cpp +++ b/Engine/source/gfx/gl/gfxGLTextureObject.cpp @@ -46,7 +46,7 @@ GFXGLTextureObject::GFXGLTextureObject(GFXDevice * aDevice, GFXTextureProfile *p { #if TORQUE_DEBUG - mFrameAllocatorMarkGuard == FrameAllocator::getWaterMark(); + mFrameAllocatorMarkGuard = FrameAllocator::getWaterMark(); #endif dMemset(&mLockedRect, 0, sizeof(mLockedRect)); diff --git a/Engine/source/gfx/gl/tGL/tGL.cpp b/Engine/source/gfx/gl/tGL/tGL.cpp index b13fec60a..5d9b4718a 100644 --- a/Engine/source/gfx/gl/tGL/tGL.cpp +++ b/Engine/source/gfx/gl/tGL/tGL.cpp @@ -25,8 +25,10 @@ #include "core/strings/stringFunctions.h" #include "console/console.h" -#ifdef TORQUE_OS_WIN - #include "tWGL.h" +#if defined(TORQUE_OS_WIN) +#include "tWGL.h" +#elif defined(TORQUE_OS_LINUX) +#include "tXGL.h" #endif namespace GL @@ -41,7 +43,18 @@ namespace GL void gglPerformExtensionBinds(void *context) { - +#if defined(TORQUE_OS_WIN) + if (!gladLoadWGL((HDC)context)) + { + AssertFatal(false, "Unable to load WGL in GLAD. Make sure your OpenGL drivers are up to date!"); + } +#elif defined(TORQUE_OS_LINUX) + + if (!gladLoadGLX(NULL, 0)) + { + AssertFatal(false, "Unable to load GLX in GLAD. Make sure your OpenGL drivers are up to date!"); + } +#endif } } diff --git a/Engine/source/gfx/sim/cubemapData.cpp b/Engine/source/gfx/sim/cubemapData.cpp index 3be7cfbda..3fbaf4afb 100644 --- a/Engine/source/gfx/sim/cubemapData.cpp +++ b/Engine/source/gfx/sim/cubemapData.cpp @@ -135,7 +135,7 @@ void CubemapData::createMap() if( initSuccess ) { mCubemap = GFX->createCubemap(); - if (mCubeMapFace == NULL || mCubeMapFace->isNull()) + if (!mCubeMapFace || mCubeMapFace->isNull()) return; mCubemap->initStatic(mCubeMapFace); } diff --git a/Engine/source/gfx/video/videoEncoderTheora.cpp b/Engine/source/gfx/video/videoEncoderTheora.cpp index d64f76487..ef88787f8 100644 --- a/Engine/source/gfx/video/videoEncoderTheora.cpp +++ b/Engine/source/gfx/video/videoEncoderTheora.cpp @@ -226,7 +226,7 @@ public: return setStatus(false); } - ogg_stream_init(&to, Platform::getRandom() * S32_MAX); + ogg_stream_init(&to, Platform::getRandom() * double(S32_MAX)); ogg_packet op; diff --git a/Engine/source/gui/controls/guiGameListMenuCtrl.cpp b/Engine/source/gui/controls/guiGameListMenuCtrl.cpp index 72b3d02f2..33efb32d8 100644 --- a/Engine/source/gui/controls/guiGameListMenuCtrl.cpp +++ b/Engine/source/gui/controls/guiGameListMenuCtrl.cpp @@ -275,8 +275,6 @@ void GuiGameListMenuCtrl::onRenderSliderOption(Row* row, Point2I currentOffset) Point2I arrowOffset; S32 columnSplit = profile->mColumnSplit * xScale; - S32 iconIndex; - bool isRowSelected = (getSelected() != NO_ROW) && (row == mRows[getSelected()]); bool isRowHighlighted = (getHighlighted() != NO_ROW) ? ((row == mRows[getHighlighted()]) && (row->mEnabled)) : false; /*if (profileHasArrows) @@ -384,8 +382,6 @@ void GuiGameListMenuCtrl::onRenderKeybindOption(Row* row, Point2I currentOffset) S32 rowHeight = profile->getRowHeight(); - S32 optionWidth = xScale - columnSplit; - GFXDrawUtil* drawer = GFX->getDrawUtil(); //drawer->drawBitmap(row->mBitmap, ) @@ -1048,7 +1044,6 @@ RectI GuiGameListMenuCtrl::getRowBounds(S32 rowIndex) { GuiGameListMenuProfile* profile = (GuiGameListMenuProfile*)mProfile; - F32 xScale = (float)getWidth() / profile->getRowWidth(); S32 rowHeight = profile->getRowHeight(); Point2I currentOffset = Point2I::Zero; @@ -1375,9 +1370,6 @@ void GuiGameListMenuCtrl::clickKeybind(Row* row, S32 xPos) S32 rowHeight = profile->getRowHeight(); - S32 optionWidth = xScale - columnSplit; - - GFXDrawUtil* drawer = GFX->getDrawUtil(); //drawer->drawBitmap(row->mBitmap, ) Point2I button; @@ -1388,7 +1380,6 @@ void GuiGameListMenuCtrl::clickKeybind(Row* row, S32 xPos) buttonSize.x = rowHeight / 2; buttonSize.y = rowHeight / 2; - GFXTextureObject* texture = row->mBitmapTex; RectI rect(button, buttonSize); if (rect.pointInRect(Point2I(xPos, rowHeight / 2))) diff --git a/Engine/source/gui/controls/guiPopUpCtrl.cpp b/Engine/source/gui/controls/guiPopUpCtrl.cpp index 47abbc17c..8e9eb5c24 100644 --- a/Engine/source/gui/controls/guiPopUpCtrl.cpp +++ b/Engine/source/gui/controls/guiPopUpCtrl.cpp @@ -311,7 +311,6 @@ void GuiPopUpMenuCtrl::initPersistFields(void) bool GuiPopUpMenuCtrl::_setBitmaps(void* obj, const char* index, const char* data) { - bool ret = false; GuiPopUpMenuCtrl* object = static_cast(obj); object->setBitmap(data); diff --git a/Engine/source/gui/controls/guiPopUpCtrlEx.cpp b/Engine/source/gui/controls/guiPopUpCtrlEx.cpp index 852424075..0a10d870c 100644 --- a/Engine/source/gui/controls/guiPopUpCtrlEx.cpp +++ b/Engine/source/gui/controls/guiPopUpCtrlEx.cpp @@ -365,7 +365,6 @@ void GuiPopUpMenuCtrlEx::initPersistFields(void) bool GuiPopUpMenuCtrlEx::_setBitmaps(void* obj, const char* index, const char* data) { - bool ret = false; GuiPopUpMenuCtrlEx* object = static_cast(obj); object->setBitmap(data); diff --git a/Engine/source/gui/core/guiCanvas.cpp b/Engine/source/gui/core/guiCanvas.cpp index 967c3e7d7..0b894f7c3 100644 --- a/Engine/source/gui/core/guiCanvas.cpp +++ b/Engine/source/gui/core/guiCanvas.cpp @@ -94,6 +94,33 @@ ConsoleDocClass( GuiCanvas, "@ingroup GuiCore\n"); + ImplementEnumType(KeyboardTranslationMode, + "Modes for handling keyboard translation or native accelerator requests.\n\n") + { GuiCanvas::TranslationMode_Platform, "Platform", + "Requests will be passed to the platform window for handling." }, + { GuiCanvas::TranslationMode_Callback, "Callback", + "Script callbacks will be issued to notify and allow override of these events." }, + { GuiCanvas::TranslationMode_Ignore, "Ignore", + "Requsts to enable/disable keyboard translations or native accelerators will be ignored " + "with no callback triggered." }, + EndImplementEnumType; + + IMPLEMENT_CALLBACK(GuiCanvas, onSetKeyboardTranslationEnabled, bool, (bool enable), (enable), + "Called when the canvas receives an enableKeyboardTranslation request. This is usually the " + "result of a GuitTextInputCtrl gaining or losing focus. Return true to allow the request " + "to be passed to the platform window. Return false to override the request and handle it in script.\n\n" + "@note This callback is only issued if keyTranslationMode is set to \"Callback\" for this canvas.\n" + "@param enable Requested keyboard translation state.\n" + "@see KeyboardTranslationMode\n"); + + IMPLEMENT_CALLBACK(GuiCanvas, onSetNativeAcceleratorsEnabled, bool, (bool enable), (enable), + "Called when the canvas receives a setNativeAcceleratorsEnabled request. This is usually the " + "result of a GuitTextInputCtrl gaining or losing focus. Return true to allow the request to " + "be passed to the platform window. Return false to override the request and handle it in script.\n\n" + "@note This callback is only issued if nativeAcceleratorMode is set to \"Callback\" for this canvas.\n" + "@param enable Requested accelerator state.\n" + "@see KeyboardTranslationMode\n"); + ColorI gCanvasClearColor( 255, 0, 255 ); ///< For GFX->clear extern InputModifiers convertModifierBits(const U32 in); @@ -127,6 +154,8 @@ GuiCanvas::GuiCanvas(): GuiControl(), mHoverPositionSet(false), mLeftMouseLast(false), mHoverLeftControlTime(0), + mKeyTranslationMode(TranslationMode_Platform), + mNativeAcceleratorMode(TranslationMode_Platform), mMiddleMouseLast(false), mRightMouseLast(false), mMouseDownPoint(0.0f,0.0f), @@ -183,6 +212,13 @@ void GuiCanvas::initPersistFields() addField("displayWindow", TypeBool, Offset(mDisplayWindow, GuiCanvas), "Controls if the canvas window is rendered or not." ); endGroup("Canvas Rendering"); + addGroup("KeyboardMode Callbacks"); + addField("keyTranslationMode", TYPEID< KeyTranslationMode >(), Offset(mKeyTranslationMode, GuiCanvas), + "How to handle enable/disable keyboard translation requests. \"Platform\", \"Callback\" or \"Ignore\".\n"); + addField("nativeAcceleratorMode", TYPEID< KeyTranslationMode >(), Offset(mNativeAcceleratorMode, GuiCanvas), + "How to handle enable/disable native accelerator requests. \"Platform\", \"Callback\" or \"Ignore\".\n"); + endGroup("KeyboardMode Callbacks"); + Parent::initPersistFields(); } @@ -442,20 +478,32 @@ Point2I GuiCanvas::getWindowSize() void GuiCanvas::enableKeyboardTranslation() { - AssertISV(mPlatformWindow, "GuiCanvas::enableKeyboardTranslation - no window present!"); - mPlatformWindow->setKeyboardTranslation(true); + if ((mKeyTranslationMode == TranslationMode_Platform) || + ((mKeyTranslationMode == TranslationMode_Callback) && onSetKeyboardTranslationEnabled_callback(true))) + { + AssertISV(mPlatformWindow, "GuiCanvas::enableKeyboardTranslation - no window present!"); + mPlatformWindow->setKeyboardTranslation(true); + } } void GuiCanvas::disableKeyboardTranslation() { - AssertISV(mPlatformWindow, "GuiCanvas::disableKeyboardTranslation - no window present!"); - mPlatformWindow->setKeyboardTranslation(false); + if ((mKeyTranslationMode == TranslationMode_Platform) || + ((mKeyTranslationMode == TranslationMode_Callback) && onSetKeyboardTranslationEnabled_callback(false))) + { + AssertISV(mPlatformWindow, "GuiCanvas::disableKeyboardTranslation - no window present!"); + mPlatformWindow->setKeyboardTranslation(false); + } } void GuiCanvas::setNativeAcceleratorsEnabled( bool enabled ) { - AssertISV(mPlatformWindow, "GuiCanvas::setNativeAcceleratorsEnabled - no window present!"); - mPlatformWindow->setAcceleratorsEnabled( enabled ); + if ((mNativeAcceleratorMode == TranslationMode_Platform) || + ((mNativeAcceleratorMode == TranslationMode_Callback) && onSetNativeAcceleratorsEnabled_callback(enabled))) + { + AssertISV(mPlatformWindow, "GuiCanvas::setNativeAcceleratorsEnabled - no window present!"); + mPlatformWindow->setAcceleratorsEnabled(enabled); + } } void GuiCanvas::setForceMouseToGUI(bool onOff) @@ -2390,7 +2438,7 @@ DefineEngineMethod( GuiCanvas, getMouseControl, S32, (),, if (control) return control->getId(); - return NULL; + return 0; } DefineEngineFunction(excludeOtherInstance, bool, (const char* appIdentifer),, diff --git a/Engine/source/gui/core/guiCanvas.h b/Engine/source/gui/core/guiCanvas.h index f9f4a37af..fdb1cfd25 100644 --- a/Engine/source/gui/core/guiCanvas.h +++ b/Engine/source/gui/core/guiCanvas.h @@ -178,6 +178,19 @@ protected: bool mHoverPositionSet; U32 mHoverLeftControlTime; +public: + /// Setting for how to handle 'enableKeyboardTranslation' and 'setNativeAcceleratorsEnabled' requests. + enum KeyTranslationMode + { + TranslationMode_Platform, + TranslationMode_Callback, + TranslationMode_Ignore, + }; + +protected: + KeyTranslationMode mKeyTranslationMode; + KeyTranslationMode mNativeAcceleratorMode; + /// @} // Internal event handling callbacks for use with PlatformWindow. @@ -454,6 +467,10 @@ public: virtual void setWindowTitle(const char *newTitle); + DECLARE_CALLBACK(bool, onSetKeyboardTranslationEnabled, (bool enable)); + DECLARE_CALLBACK(bool, onSetNativeAcceleratorsEnabled, (bool enable)); + + private: static const U32 MAX_GAMEPADS = 4; ///< The maximum number of supported gamepads protected: @@ -464,5 +481,7 @@ private: void setConsumeLastInputEvent(bool flag) { mConsumeLastInputEvent = flag; } bool getLastCursorPoint(Point2I& pt) const { pt = mLastCursorPt; return mLastCursorEnabled; } }; +typedef GuiCanvas::KeyTranslationMode KeyboardTranslationMode; +DefineEnumType(KeyboardTranslationMode); #endif diff --git a/Engine/source/gui/editor/guiInspector.cpp b/Engine/source/gui/editor/guiInspector.cpp index 48c4dcc94..47d1e3c85 100644 --- a/Engine/source/gui/editor/guiInspector.cpp +++ b/Engine/source/gui/editor/guiInspector.cpp @@ -908,12 +908,12 @@ DefineEngineMethod( GuiInspector, findByObject, S32, (SimObject* obj), , "@return id of an awake inspector that is inspecting the passed object if one exists, else NULL or 0.") { if ( !obj) - return NULL; + return 0; SimObject *inspector = GuiInspector::findByObject(obj); if ( !inspector ) - return NULL; + return 0; return inspector->getId(); } diff --git a/Engine/source/gui/editor/guiShapeEdPreview.cpp b/Engine/source/gui/editor/guiShapeEdPreview.cpp index 5ea20ec13..eba775edb 100644 --- a/Engine/source/gui/editor/guiShapeEdPreview.cpp +++ b/Engine/source/gui/editor/guiShapeEdPreview.cpp @@ -160,11 +160,11 @@ void GuiShapeEdPreview::initPersistFields() addGroup( "Animation" ); addField( "activeThread", TypeS32, Offset( mActiveThread, GuiShapeEdPreview ), "Index of the active thread, or -1 if none" ); - addProtectedField( "threadPos", TypeF32, NULL, &setFieldThreadPos, &getFieldThreadPos, + addProtectedField( "threadPos", TypeF32, 0, &setFieldThreadPos, &getFieldThreadPos, "Current position of the active thread (0-1)" ); - addProtectedField( "threadDirection", TypeS32, NULL, &setFieldThreadDir, &getFieldThreadDir, + addProtectedField( "threadDirection", TypeS32, 0, &setFieldThreadDir, &getFieldThreadDir, "Playback direction of the active thread" ); - addProtectedField( "threadPingPong", TypeBool, NULL, &setFieldThreadPingPong, &getFieldThreadPingPong, + addProtectedField( "threadPingPong", TypeBool, 0, &setFieldThreadPingPong, &getFieldThreadPingPong, "'PingPong' mode of the active thread" ); endGroup( "Animation" ); diff --git a/Engine/source/gui/utility/guiRenderTargetVizCtrl.cpp b/Engine/source/gui/utility/guiRenderTargetVizCtrl.cpp index 91544f5e0..6c1366afb 100644 --- a/Engine/source/gui/utility/guiRenderTargetVizCtrl.cpp +++ b/Engine/source/gui/utility/guiRenderTargetVizCtrl.cpp @@ -102,8 +102,6 @@ void GuiRenderTargetVizCtrl::onRender(Point2I offset, camObject = dynamic_cast(camObject->getClientObject()); - bool servObj = camObject->isServerObject(); - if (camObject) { GFXTexHandle targ = camObject->getCameraRenderTarget(); diff --git a/Engine/source/gui/worldEditor/guiConvexShapeEditorCtrl.h b/Engine/source/gui/worldEditor/guiConvexShapeEditorCtrl.h index 6ede0cf61..1600a4e50 100644 --- a/Engine/source/gui/worldEditor/guiConvexShapeEditorCtrl.h +++ b/Engine/source/gui/worldEditor/guiConvexShapeEditorCtrl.h @@ -248,7 +248,7 @@ class GuiConvexEditorUndoAction : public UndoAction friend class GuiConvexEditorCtrl; public: - GuiConvexEditorUndoAction( const UTF8* actionName ) : UndoAction( actionName ), mEditor(NULL), mObjId(NULL) + GuiConvexEditorUndoAction( const UTF8* actionName ) : UndoAction( actionName ), mEditor(NULL), mObjId(0) { } diff --git a/Engine/source/gui/worldEditor/guiMissionArea.h b/Engine/source/gui/worldEditor/guiMissionArea.h index c14438ac6..32d68ecc7 100644 --- a/Engine/source/gui/worldEditor/guiMissionArea.h +++ b/Engine/source/gui/worldEditor/guiMissionArea.h @@ -145,7 +145,7 @@ class GuiMissionAreaUndoAction : public UndoAction { public: - GuiMissionAreaUndoAction( const UTF8* actionName ) : UndoAction( actionName ), mMissionAreaEditor(NULL), mObjId(NULL) + GuiMissionAreaUndoAction( const UTF8* actionName ) : UndoAction( actionName ), mMissionAreaEditor(NULL), mObjId(0) { } diff --git a/Engine/source/gui/worldEditor/terrainActions.cpp b/Engine/source/gui/worldEditor/terrainActions.cpp index 3fc07205d..a6fbb5c21 100644 --- a/Engine/source/gui/worldEditor/terrainActions.cpp +++ b/Engine/source/gui/worldEditor/terrainActions.cpp @@ -773,7 +773,7 @@ ConsoleDocClass( TerrainSmoothAction, ); TerrainSmoothAction::TerrainSmoothAction() - : UndoAction("Terrain Smoothing"), mFactor(1.0), mSteps(1), mTerrainId(NULL) + : UndoAction("Terrain Smoothing"), mFactor(1.0), mSteps(1), mTerrainId(0) { } diff --git a/Engine/source/lighting/advanced/advancedLightBinManager.cpp b/Engine/source/lighting/advanced/advancedLightBinManager.cpp index 322560799..fd8cd6dc4 100644 --- a/Engine/source/lighting/advanced/advancedLightBinManager.cpp +++ b/Engine/source/lighting/advanced/advancedLightBinManager.cpp @@ -323,8 +323,6 @@ void AdvancedLightBinManager::_scoreLights(const MatrixF& cameraTrans) { if (dist > smLightFadeStart) { - F32 brightness = light.lightInfo->getBrightness(); - float fadeOutAmt = (dist - smLightFadeStart) / (smLightFadeEnd - smLightFadeStart); fadeOutAmt = 1 - fadeOutAmt; diff --git a/Engine/source/lighting/advanced/advancedLightBinManager.h b/Engine/source/lighting/advanced/advancedLightBinManager.h index 4f97e4239..4d04f3cfc 100644 --- a/Engine/source/lighting/advanced/advancedLightBinManager.h +++ b/Engine/source/lighting/advanced/advancedLightBinManager.h @@ -70,7 +70,7 @@ protected: GFXStateBlockRef mLitState[NUM_LIT_STATES][2]; public: - LightMatInstance(Material &mat) : Parent(mat), mLightMapParamsSC(NULL), mInternalPass(false), mSpecialLight(NULL) {} + LightMatInstance(Material &mat) : Parent(mat), mLightMapParamsSC(NULL), mInternalPass(false), mSpecialLight(false) {} virtual bool init( const FeatureSet &features, const GFXVertexFormat *vertexFormat ); virtual bool setupPass( SceneRenderState *state, const SceneData &sgData ); diff --git a/Engine/source/lighting/basic/blTerrainSystem.cpp b/Engine/source/lighting/basic/blTerrainSystem.cpp index d6fb3f9d5..1cf077575 100644 --- a/Engine/source/lighting/basic/blTerrainSystem.cpp +++ b/Engine/source/lighting/basic/blTerrainSystem.cpp @@ -682,9 +682,9 @@ bool blTerrainSystem::createPersistChunkFromProxy(SceneLighting::ObjectProxy* ob { *ret = new blTerrainChunk(); return true; - } else { - return NULL; } + + return false; } // Given a ray, this will return the color from the lightmap of this object, return true if handled diff --git a/Engine/source/lighting/shadowMap/shadowMatHook.cpp b/Engine/source/lighting/shadowMap/shadowMatHook.cpp index 30f2db593..c6b8bab01 100644 --- a/Engine/source/lighting/shadowMap/shadowMatHook.cpp +++ b/Engine/source/lighting/shadowMap/shadowMatHook.cpp @@ -186,10 +186,8 @@ void ShadowMaterialHook::_overrideFeatures( ProcessedMaterial *mat, type == MFT_TexAnim || type == MFT_DiffuseMap || type == MFT_IsTranslucent || - type == MFT_Visibility || type == MFT_UseInstancing || - type == MFT_EyeSpaceDepthOut || - type == MFT_DeferredConditioner) + type == MFT_EyeSpaceDepthOut) newFeatures.addFeature(type); else if (type.getGroup() == MFG_PreTransform || type.getGroup() == MFG_Transform || diff --git a/Engine/source/materials/materialDefinition.cpp b/Engine/source/materials/materialDefinition.cpp index 823072c4f..07a769ee7 100644 --- a/Engine/source/materials/materialDefinition.cpp +++ b/Engine/source/materials/materialDefinition.cpp @@ -218,7 +218,7 @@ Material::Material() mPlanarReflection = false; mCubemapData = NULL; - mDynamicCubemap = NULL; + mDynamicCubemap = false; mLastUpdateTime = 0; diff --git a/Engine/source/materials/processedShaderMaterial.cpp b/Engine/source/materials/processedShaderMaterial.cpp index fc453958f..b6d7be05c 100644 --- a/Engine/source/materials/processedShaderMaterial.cpp +++ b/Engine/source/materials/processedShaderMaterial.cpp @@ -1290,16 +1290,9 @@ void ProcessedShaderMaterial::setCustomShaderData(VectormCustomHandles.size(); ++h) - { - StringTableEntry handleName = shaderData[i].getHandleName(); - bool tmp = true; - } //roll through and try setting our data! for (U32 h = 0; h < handles->mCustomHandles.size(); ++h) { - StringTableEntry handleName = shaderData[i].getHandleName(); - StringTableEntry rpdHandleName = handles->mCustomHandles[h].handleName; if (handles->mCustomHandles[h].handleName == shaderData[i].getHandleName()) { if (handles->mCustomHandles[h].handle->isValid()) diff --git a/Engine/source/math/mRandom.h b/Engine/source/math/mRandom.h index c69c06477..dbd4a2328 100644 --- a/Engine/source/math/mRandom.h +++ b/Engine/source/math/mRandom.h @@ -54,7 +54,7 @@ public: inline F32 MRandomGenerator::randF() { // default: multiply by 1/(2^31) - return F32(randI()) * (1.0f / S32_MAX); + return F32(randI()) * (1.0f / F64(S32_MAX)); } inline S32 MRandomGenerator::randI(S32 i, S32 n) diff --git a/Engine/source/math/mRotation.cpp b/Engine/source/math/mRotation.cpp index 43b696d4a..18114c58d 100644 --- a/Engine/source/math/mRotation.cpp +++ b/Engine/source/math/mRotation.cpp @@ -325,14 +325,21 @@ TEST(Maths, RotationF_Calculations) }; #endif -DefineEngineFunction(AddRotation, RotationF, (RotationF a, RotationF b), , +DefineEngineFunction(AddRotation, RotationF, (RotationF a, RotationF b, const char* returnType), ("Euler"), "Adds two rotations together.\n" "@param a Rotation one." "@param b Rotation two." "@returns v sum of both rotations." "@ingroup Math") { - return a + b; + RotationF ret; + RotationF sum = a + b; + if (String(returnType) == String("Euler")) + ret.set(sum.asEulerF()); + else + ret.set(sum.asAxisAngle()); + + return ret; } DefineEngineFunction(SubtractRotation, RotationF, (RotationF a, RotationF b), , diff --git a/Engine/source/math/mathTypes.cpp b/Engine/source/math/mathTypes.cpp index 14c7335e8..70ac9adf7 100644 --- a/Engine/source/math/mathTypes.cpp +++ b/Engine/source/math/mathTypes.cpp @@ -620,8 +620,16 @@ ConsoleGetType(TypeRotationF) static const U32 bufSize = 256; char* returnBuffer = Con::getReturnBuffer(bufSize); - EulerF out = pt->asEulerF(RotationF::Degrees); - dSprintf(returnBuffer, bufSize, "%g %g %g", out.x, out.y, out.z); + if (pt->mRotationType == RotationF::Euler) + { + EulerF out = pt->asEulerF(RotationF::Degrees); + dSprintf(returnBuffer, bufSize, "%g %g %g", out.x, out.y, out.z); + } + else if (pt->mRotationType == RotationF::AxisAngle) + { + AngAxisF out = pt->asAxisAngle(RotationF::Degrees); + dSprintf(returnBuffer, bufSize, "%g %g %g %g", out.axis.x, out.axis.y, out.axis.z, out.angle); + } return returnBuffer; } diff --git a/Engine/source/navigation/guiNavEditorCtrl.h b/Engine/source/navigation/guiNavEditorCtrl.h index 4a6780b33..2d4c96bce 100644 --- a/Engine/source/navigation/guiNavEditorCtrl.h +++ b/Engine/source/navigation/guiNavEditorCtrl.h @@ -168,7 +168,7 @@ protected: class GuiNavEditorUndoAction : public UndoAction { public: - GuiNavEditorUndoAction(const UTF8* actionName) : UndoAction(actionName), mNavEditor(NULL), mObjId(NULL) + GuiNavEditorUndoAction(const UTF8* actionName) : UndoAction(actionName), mNavEditor(NULL), mObjId(0) { } diff --git a/Engine/source/persistence/taml/taml.cpp b/Engine/source/persistence/taml/taml.cpp index 837843c72..b05b0d8bc 100644 --- a/Engine/source/persistence/taml/taml.cpp +++ b/Engine/source/persistence/taml/taml.cpp @@ -335,7 +335,7 @@ ImplementEnumType(_TamlFormatMode, // Write. //return writer.write( stream, pRootNode ); - return NULL; + return false; } /// Invalid. @@ -640,7 +640,7 @@ ImplementEnumType(_TamlFormatMode, // Iterate fields. U8 arrayDepth = 0; - TamlCustomNode* currentArrayNode; + TamlCustomNode* currentArrayNode = NULL; for (U32 index = 0; index < fieldCount; ++index) { // Fetch field. diff --git a/Engine/source/platform/async/asyncPacketStream.h b/Engine/source/platform/async/asyncPacketStream.h index 44b4b661f..00f798946 100644 --- a/Engine/source/platform/async/asyncPacketStream.h +++ b/Engine/source/platform/async/asyncPacketStream.h @@ -282,7 +282,7 @@ void AsyncPacketBufferedInputStream< Stream, Packet >::_requestNext() if( resettable ) { IPositionable< U32 >* positionable = dynamic_cast< IPositionable< U32 >* >( &Deref( stream ) ); - U32 pos; + U32 pos = 0; if(positionable) pos = positionable->getPosition(); diff --git a/Engine/source/platform/platformNet.cpp b/Engine/source/platform/platformNet.cpp index 1e5cb0a5a..a97a094c0 100644 --- a/Engine/source/platform/platformNet.cpp +++ b/Engine/source/platform/platformNet.cpp @@ -95,36 +95,6 @@ typedef int SOCKET; #endif -#if defined(TORQUE_USE_WINSOCK) -static const char* strerror_wsa( S32 code ) -{ - switch( code ) - { -#define E( name ) case name: return #name; - E( WSANOTINITIALISED ); - E( WSAENETDOWN ); - E( WSAEADDRINUSE ); - E( WSAEINPROGRESS ); - E( WSAEALREADY ); - E( WSAEADDRNOTAVAIL ); - E( WSAEAFNOSUPPORT ); - E( WSAEFAULT ); - E( WSAEINVAL ); - E( WSAEISCONN ); - E( WSAENETUNREACH ); - E( WSAEHOSTUNREACH ); - E( WSAENOBUFS ); - E( WSAENOTSOCK ); - E( WSAETIMEDOUT ); - E( WSAEWOULDBLOCK ); - E( WSAEACCES ); -#undef E - default: - return "Unknown"; - } -} -#endif - #include "core/util/tVector.h" #include "platform/platformNetAsync.h" #include "console/console.h" @@ -241,7 +211,7 @@ namespace PlatformNetState struct addrinfo* pickAddressByProtocol(struct addrinfo* addr, int protocol) { - for (addr; addr != NULL; addr = addr->ai_next) + for (; addr != NULL; addr = addr->ai_next) { if (addr->ai_family == protocol) return addr; @@ -1243,7 +1213,8 @@ void Net::process() } break; case PolledSocket::NameLookupRequired: - U32 newState; + { + U32 newState = Net::NoError; // is the lookup complete? if (!gNetAsync.checkLookup( @@ -1262,7 +1233,7 @@ void Net::process() { // try to connect out_h_addr.port = currentSock->remotePort; - const sockaddr *ai_addr = NULL; + const sockaddr* ai_addr = NULL; int ai_addrlen = 0; sockaddr_in socketAddress; sockaddr_in6 socketAddress6; @@ -1304,7 +1275,7 @@ void Net::process() else { Con::errorf("Error connecting to %s: Invalid Protocol", - currentSock->remoteAddr); + currentSock->remoteAddr); newState = Net::ConnectFailed; removeSock = true; removeSockHandle = currentSock->handleFd; @@ -1319,7 +1290,7 @@ void Net::process() if (err != Net::WouldBlock) { Con::errorf("Error connecting to %s: %u", - currentSock->remoteAddr, err); + currentSock->remoteAddr, err); newState = Net::ConnectFailed; removeSock = true; removeSockHandle = currentSock->handleFd; @@ -1340,6 +1311,7 @@ void Net::process() smConnectionNotify->trigger(currentSock->handleFd, newState); break; + } case PolledSocket::Listening: NetAddress incomingAddy; diff --git a/Engine/source/platform/types.gcc.h b/Engine/source/platform/types.gcc.h index 8255a251d..f6f4cf6df 100644 --- a/Engine/source/platform/types.gcc.h +++ b/Engine/source/platform/types.gcc.h @@ -107,7 +107,7 @@ typedef unsigned long U64; // This could be reconfigured for static builds, though minimal impact //# define TORQUE_SUPPORTS_NASM # endif -#else +#else # error "GCC: Unsupported Operating System" #endif @@ -169,5 +169,8 @@ typedef unsigned long U64; #endif #endif -#endif // INCLUDED_TYPES_GCC_H +#define TORQUE_U16_ENDIANSWAP_BUILTIN __builtin_bswap16 +#define TORQUE_U32_ENDIANSWAP_BUILTIN __builtin_bswap32 +#define TORQUE_U64_ENDIANSWAP_BUILTIN __builtin_bswap64 +#endif // INCLUDED_TYPES_GCC_H diff --git a/Engine/source/platform/types.visualc.h b/Engine/source/platform/types.visualc.h index 4ccc6ce42..2be0e51b3 100644 --- a/Engine/source/platform/types.visualc.h +++ b/Engine/source/platform/types.visualc.h @@ -23,6 +23,7 @@ #ifndef INCLUDED_TYPES_VISUALC_H #define INCLUDED_TYPES_VISUALC_H +#include // For more information on VisualC++ predefined macros // http://support.microsoft.com/default.aspx?scid=kb;EN-US;q65472 @@ -69,7 +70,7 @@ typedef unsigned _int64 U64; # define TORQUE_OS_WIN # define TORQUE_OS_WIN64 # include "platform/types.win.h" -#else +#else # error "VC: Unsupported Operating System" #endif @@ -115,5 +116,8 @@ typedef unsigned _int64 U64; #define TORQUE_UNLIKELY #endif -#endif // INCLUDED_TYPES_VISUALC_H +#define TORQUE_U16_ENDIANSWAP_BUILTIN _byteswap_ushort +#define TORQUE_U32_ENDIANSWAP_BUILTIN _byteswap_ulong +#define TORQUE_U64_ENDIANSWAP_BUILTIN _byteswap_uint64 +#endif // INCLUDED_TYPES_VISUALC_H diff --git a/Engine/source/platformSDL/sdlInput.cpp b/Engine/source/platformSDL/sdlInput.cpp index a60a0e7b5..67d86b277 100644 --- a/Engine/source/platformSDL/sdlInput.cpp +++ b/Engine/source/platformSDL/sdlInput.cpp @@ -102,7 +102,7 @@ U16 Input::getKeyCode( U16 asciiCode ) char c[2]; c[0]= asciiCode; - c[1] = NULL; + c[1] = 0; return KeyMapSDL::getTorqueScanCodeFromSDL( SDL_GetScancodeFromKey( SDL_GetKeyFromName(c) ) ); } diff --git a/Engine/source/platformX86UNIX/x86UNIXFileio.cpp b/Engine/source/platformX86UNIX/x86UNIXFileio.cpp index 77419a96a..eee06a84e 100644 --- a/Engine/source/platformX86UNIX/x86UNIXFileio.cpp +++ b/Engine/source/platformX86UNIX/x86UNIXFileio.cpp @@ -594,20 +594,20 @@ bool dPathCopy(const char *fromName, const char *toName, bool nooverwrite) return currentStatus; U32 finalPos = 0; - switch (absolutePos) + + if (absolutePos) { - case true: // absolute position AssertFatal(0 <= position, "File::setPosition: negative absolute position"); // position beyond EOS is OK finalPos = lseek(*((int *)handle), position, SEEK_SET); - break; - case false: // relative position + } + else + { AssertFatal((getPosition() >= (U32)abs(position) && 0 > position) || 0 <= position, "File::setPosition: negative relative position"); // position beyond EOS is OK finalPos = lseek(*((int *)handle), position, SEEK_CUR); - break; } if (0xffffffff == finalPos) @@ -1110,7 +1110,7 @@ bool dPathCopy(const char *fromName, const char *toName, bool nooverwrite) if (dip == NULL) return false; - while (d = readdir(dip)) + while ((d = readdir(dip))) { bool isDir = false; if (d->d_type == DT_UNKNOWN) @@ -1229,14 +1229,14 @@ bool dPathCopy(const char *fromName, const char *toName, bool nooverwrite) // Iterate through and grab valid directories ////////////////////////////////////////////////////////////////////////// - while (d = readdir(dip)) + while ((d = readdir(dip))) { bool isDir; isDir = false; if (d->d_type == DT_UNKNOWN) { char child [1024]; - if ((Path[dStrlen(Path) - 1] == '/')) + if (Path[dStrlen(Path) - 1] == '/') dSprintf(child, 1024, "%s%s", Path, d->d_name); else dSprintf(child, 1024, "%s/%s", Path, d->d_name); diff --git a/Engine/source/platformX86UNIX/x86UNIXProcessControl.cpp b/Engine/source/platformX86UNIX/x86UNIXProcessControl.cpp index 09c59af4d..db7d0bdb7 100644 --- a/Engine/source/platformX86UNIX/x86UNIXProcessControl.cpp +++ b/Engine/source/platformX86UNIX/x86UNIXProcessControl.cpp @@ -24,6 +24,8 @@ #include "platformX86UNIX/x86UNIXState.h" #include "platformX86UNIX/x86UNIXStdConsole.h" #include "platform/platformInput.h" +#include "windowManager/platformWindow.h" +#include "windowManager/platformWindowMgr.h" #include "console/console.h" #include @@ -165,6 +167,15 @@ void Platform::debugBreak() Con::errorf(ConsoleLogEntry::General, "Platform::debugBreak: triggering SIGSEGV for core dump"); //kill(getpid(), SIGSEGV); + + // On Linux, the mouse cursor will remain trapped when the SIGTRAP below triggers so we ensure the mouse + // locked state is disabled prior to dropping to debug + PlatformWindow* firstWindow = WindowManager->getFirstWindow(); + if (firstWindow) + { + firstWindow->setMouseLocked(false); + } + kill(getpid(), SIGTRAP); } diff --git a/Engine/source/postFx/postEffectManager.cpp b/Engine/source/postFx/postEffectManager.cpp index 7904c522d..d65e25e25 100644 --- a/Engine/source/postFx/postEffectManager.cpp +++ b/Engine/source/postFx/postEffectManager.cpp @@ -141,7 +141,7 @@ GFXTextureObject* PostEffectManager::getBackBufferTex() mBackBufferCopyTex.set( targetSize.x, targetSize.y, targetFormat, - &PostFxTargetProfile, "mBackBufferCopyTex" ); + &PostFxTextureSRGBProfile, "mBackBufferCopyTex" ); target->resolveTo( mBackBufferCopyTex ); mLastBackBufferTarget = target; diff --git a/Engine/source/renderInstance/renderImposterMgr.cpp b/Engine/source/renderInstance/renderImposterMgr.cpp index d93c6c620..e0b8b3156 100644 --- a/Engine/source/renderInstance/renderImposterMgr.cpp +++ b/Engine/source/renderInstance/renderImposterMgr.cpp @@ -152,7 +152,7 @@ void RenderImposterMgr::_innerRender( const SceneRenderState *state, RenderDefer // Setup a static index buffer for rendering. mIB.set( GFX, smImposterBatchSize * 6, 0, GFXBufferTypeStatic ); U16 *idxBuff; - mIB.lock(&idxBuff, NULL, NULL, NULL); + mIB.lock(&idxBuff, NULL, 0, 0); for ( U32 i=0; i < smImposterBatchSize; i++ ) { // diff --git a/Engine/source/renderInstance/renderPassStateToken.cpp b/Engine/source/renderInstance/renderPassStateToken.cpp index 560fb40f3..c00b05cdf 100644 --- a/Engine/source/renderInstance/renderPassStateToken.cpp +++ b/Engine/source/renderInstance/renderPassStateToken.cpp @@ -86,7 +86,7 @@ static const char *_get_enable(void* obj, const char* data) void RenderPassStateToken::initPersistFields() { - addProtectedField("enabled", TypeBool, NULL, &_set_enable, &_get_enable, "Enables or disables this token."); + addProtectedField("enabled", TypeBool, 0, &_set_enable, &_get_enable, "Enables or disables this token."); Parent::initPersistFields(); } diff --git a/Engine/source/renderInstance/renderTranslucentMgr.cpp b/Engine/source/renderInstance/renderTranslucentMgr.cpp index 725cd3e7e..8c4b0cc8c 100644 --- a/Engine/source/renderInstance/renderTranslucentMgr.cpp +++ b/Engine/source/renderInstance/renderTranslucentMgr.cpp @@ -144,7 +144,6 @@ void RenderTranslucentMgr::render( SceneRenderState *state ) GFXTextureObject *lastLM = NULL; GFXCubemap *lastCubemap = NULL; GFXTextureObject *lastReflectTex = NULL; - GFXTextureObject *lastMiscTex = NULL; GFXTextureObject *lastAccuTex = NULL; // Find the particle render manager (if we don't have it) diff --git a/Engine/source/scene/mixin/scenePolyhedralObject.impl.h b/Engine/source/scene/mixin/scenePolyhedralObject.impl.h index 4ce8998f0..32ec98e71 100644 --- a/Engine/source/scene/mixin/scenePolyhedralObject.impl.h +++ b/Engine/source/scene/mixin/scenePolyhedralObject.impl.h @@ -44,15 +44,15 @@ void ScenePolyhedralObject< Base, P >::initPersistFields() { Parent::addGroup( "Internal" ); - Parent::addProtectedField( "plane", TypeRealString, NULL, + Parent::addProtectedField( "plane", TypeRealString, 0, &_setPlane, &defaultProtectedGetFn, "For internal use only.", AbstractClassRep::FIELD_HideInInspectors ); - Parent::addProtectedField( "point", TypeRealString, NULL, + Parent::addProtectedField( "point", TypeRealString, 0, &_setPoint, &defaultProtectedGetFn, "For internal use only.", AbstractClassRep::FIELD_HideInInspectors ); - Parent::addProtectedField( "edge", TypeRealString, NULL, + Parent::addProtectedField( "edge", TypeRealString, 0, &_setEdge, &defaultProtectedGetFn, "For internal use only.", AbstractClassRep::FIELD_HideInInspectors ); diff --git a/Engine/source/sfx/openal/aldlist.cpp b/Engine/source/sfx/openal/aldlist.cpp index a453579e3..73307f50b 100644 --- a/Engine/source/sfx/openal/aldlist.cpp +++ b/Engine/source/sfx/openal/aldlist.cpp @@ -55,9 +55,20 @@ ALDeviceList::ALDeviceList( const OPENALFNTABLE &oalft ) defaultDeviceIndex = 0; // grab function pointers for 1.0-API functions, and if successful proceed to enumerate all devices - if (ALFunction.alcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT")) { - devices = (char *)ALFunction.alcGetString(NULL, ALC_DEVICE_SPECIFIER); - defaultDeviceName = (char *)ALFunction.alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER); + const bool enumerationExtensionPresent = ALFunction.alcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT"); + const bool enumerateAllExtensionPresent = ALFunction.alcIsExtensionPresent(NULL, "ALC_ENUMERATE_ALL_EXT"); + if (enumerateAllExtensionPresent || enumerationExtensionPresent) { + if (enumerateAllExtensionPresent) + { + devices = (char *)ALFunction.alcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER); + defaultDeviceName = (char *)ALFunction.alcGetString(NULL, ALC_DEFAULT_ALL_DEVICES_SPECIFIER); + } + else + { + devices = (char *)ALFunction.alcGetString(NULL, ALC_DEVICE_SPECIFIER); + defaultDeviceName = (char *)ALFunction.alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER); + } + index = 0; // go through device list (each device terminated with a single NULL, list terminated with double NULL) while (*devices != 0) { @@ -70,7 +81,7 @@ ALDeviceList::ALDeviceList( const OPENALFNTABLE &oalft ) if (context) { ALFunction.alcMakeContextCurrent(context); // if new actual device name isn't already in the list, then add it... - actualDeviceName = ALFunction.alcGetString(device, ALC_DEVICE_SPECIFIER); + actualDeviceName = devices; bool bNewName = true; for (int i = 0; i < GetNumDevices(); i++) { if (String::compare(GetDeviceName(i), actualDeviceName) == 0) { @@ -313,4 +324,4 @@ unsigned int ALDeviceList::GetMaxNumSources() } return iSourceCount; -} \ No newline at end of file +} diff --git a/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp b/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp index 2bd24931d..bb09113a4 100644 --- a/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp +++ b/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp @@ -474,25 +474,11 @@ Var* ShaderFeatureGLSL::getInVpos( MultiLine *meta, return inVpos; ShaderConnector *connectComp = dynamic_cast( componentList[C_CONNECTOR] ); - /* - if ( GFX->getPixelShaderVersion() >= 3.0f ) - { - inVpos = connectComp->getElement( RT_VPOS ); - inVpos->setName( "vpos" ); - inVpos->setStructName( "IN" ); - inVpos->setType( "vec2" ); - return inVpos; - } - */ inVpos = connectComp->getElement( RT_TEXCOORD ); inVpos->setName( "inVpos" ); inVpos->setStructName( "IN" ); inVpos->setType( "vec4" ); - - Var *vpos = new Var( "vpos", "vec2" ); - meta->addStatement( new GenOp( " @ = @.xy / @.w;\r\n", new DecOp( vpos ), inVpos, inVpos ) ); - - return vpos; + return inVpos; } Var* ShaderFeatureGLSL::getInWorldToTangent( Vector &componentList ) @@ -779,6 +765,21 @@ Var* ShaderFeatureGLSL::getWsView( Var *wsPosition, MultiLine *meta ) return wsView; } +Var* ShaderFeatureGLSL::getInWorldNormal(Vector& componentList) +{ + Var* wsNormal = (Var*)LangElement::find("wsNormal"); + if (!wsNormal) + { + ShaderConnector* connectComp = dynamic_cast(componentList[C_CONNECTOR]); + wsNormal = connectComp->getElement(RT_TEXCOORD); + wsNormal->setName("wsNormal"); + wsNormal->setStructName("IN"); + wsNormal->setType("float3"); + } + + return wsNormal; +} + Var* ShaderFeatureGLSL::addOutDetailTexCoord( Vector &componentList, MultiLine *meta, bool useTexAnim, @@ -865,21 +866,23 @@ Var* ShaderFeatureGLSL::getSurface(Vector& componentList, Mult meta->addStatement(new GenOp(" @ = vec4(0.0,1.0,@,@);\r\n", colorDecl, roughness, metalness)); //reconstruct ormConfig, no ao darkening } - Var* wsNormal = (Var*)LangElement::find("wsNormal"); Var* normal = (Var*)LangElement::find("normal"); if (!normal) { normal = new Var("normal", "vec3"); meta->addStatement(new GenOp(" @;\r\n\n", new DecOp(normal))); + + Var* wsNormal = (Var*)LangElement::find("wsNormal"); if (!fd.features[MFT_NormalMap]) { - Var* worldToTangent = getInWorldToTangent(componentList); - meta->addStatement(new GenOp(" @ = normalize(tMul(@,vec3(0,0,1.0f)));\r\n\n", normal, worldToTangent)); + if (!wsNormal) + wsNormal = getInWorldNormal(componentList); + meta->addStatement(new GenOp(" @ = normalize( @ );\r\n\n", normal, wsNormal)); } else { - meta->addStatement(new GenOp(" @ = normalize( half3( @ ) );\r\n", normal, wsNormal)); - } + meta->addStatement(new GenOp(" @ = normalize( @ );\r\n", normal, wsNormal)); + } } Var* wsEyePos = (Var*)LangElement::find("eyePosWorld"); @@ -1979,6 +1982,7 @@ void ReflectCubeFeatGLSL::processPix( Vector &componentList, Var *envColor = new Var("envColor", "vec3"); meta->addStatement(new GenOp(" @ = @.rgb - (@.rgb * @);\r\n", new DecOp(dColor), targ, targ, metalness)); meta->addStatement(new GenOp(" @ = @.rgb*(@).rgb;\r\n", new DecOp(envColor), targ, texCube)); + meta->addStatement(new GenOp(" @.rgb = @+@;\r\n", targ, dColor, envColor)); } else if (lerpVal) meta->addStatement(new GenOp(" @ *= vec4(@.rgb*@.a, @.a);\r\n", targ, texCube, lerpVal, targ)); @@ -2067,7 +2071,6 @@ RTLightingFeatGLSL::RTLightingFeatGLSL() void RTLightingFeatGLSL::processVert( Vector &componentList, const MaterialFeatureData &fd ) { - if (fd.features[MFT_ImposterVert]) return; MultiLine *meta = new MultiLine; ShaderConnector *connectComp = dynamic_cast( componentList[C_CONNECTOR] ); @@ -2104,12 +2107,15 @@ void RTLightingFeatGLSL::processVert( Vector &componentList, return; } - + + addOutWsPosition( componentList, fd.features[MFT_UseInstancing], meta ); + getOutWorldToTangent(componentList, meta, fd); + + output = meta; + // Find the incoming vertex normal. Var *inNormal = (Var*)LangElement::find( "normal" ); - - // Skip out on realtime lighting if we don't have a normal - // or we're doing some sort of baked lighting. + if ( !inNormal || fd.features[MFT_LightMap] || fd.features[MFT_ToneMap] || @@ -2118,8 +2124,7 @@ void RTLightingFeatGLSL::processVert( Vector &componentList, // If there isn't a normal map then we need to pass // the world space normal to the pixel shader ourselves. - //Temporarily disabled while we figure out how to better handle normals without a normal map - /*if ( !fd.features[MFT_NormalMap] ) + if ( !fd.features[MFT_NormalMap] ) { Var *outNormal = connectComp->getElement( RT_TEXCOORD ); outNormal->setName( "wsNormal" ); @@ -2131,13 +2136,8 @@ void RTLightingFeatGLSL::processVert( Vector &componentList, // Transform the normal to world space. meta->addStatement( new GenOp( " @ = tMul( @, vec4( normalize( @ ), 0.0 ) ).xyz;\r\n", outNormal, objTrans, inNormal ) ); - }*/ + } - addOutWsPosition( componentList, fd.features[MFT_UseInstancing], meta ); - - getOutWorldToTangent(componentList, meta, fd); - - output = meta; } void RTLightingFeatGLSL::processPix( Vector &componentList, @@ -2158,14 +2158,10 @@ void RTLightingFeatGLSL::processPix( Vector &componentList, // Now the wsPosition and wsView. Var *wsPosition = getInWsPosition( componentList ); + Var* worldToTangent = getInWorldToTangent(componentList); + Var* wsNormal = getInWorldNormal(componentList); Var *wsView = getWsView( wsPosition, meta ); - // Create temporaries to hold results of lighting. - Var *rtShading = new Var( "rtShading", "vec4" ); - Var *specular = new Var( "specular", "vec4" ); - meta->addStatement( new GenOp( " @; @;\r\n", - new DecOp( rtShading ), new DecOp( specular ) ) ); - // Look for a light mask generated from a previous // feature (this is done for BL terrain lightmaps). LangElement *lightMask = LangElement::find( "lightMask" ); @@ -2473,7 +2469,7 @@ void VisibilityFeatGLSL::processPix( Vector &componentList, // Everything else does a fizzle. Var *vPos = getInVpos( meta, componentList ); - meta->addStatement( new GenOp( " fizzle( @, @ );\r\n", vPos, visibility ) ); + meta->addStatement( new GenOp( " fizzle( @.xy, @ );\r\n", vPos, visibility ) ); } ShaderFeature::Resources VisibilityFeatGLSL::getResources( const MaterialFeatureData &fd ) @@ -2616,7 +2612,7 @@ void FoliageFeatureGLSL::processVert( Vector &componentList, tangent->setType( "vec3" ); tangent->setName( "T" ); LangElement *tangentDec = new DecOp( tangent ); - meta->addStatement( new GenOp( " @;\n", tangentDec ) ); + meta->addStatement( new GenOp( " @ = vec3(1.0,0,0);\n", tangentDec ) ); // We add a float foliageFade to the OUT structure. ShaderConnector *connectComp = dynamic_cast( componentList[C_CONNECTOR] ); @@ -2978,6 +2974,8 @@ void ReflectionProbeFeatGLSL::processPix(Vector& componentList // Now the wsPosition and wsView. Var *wsPosition = getInWsPosition(componentList); + Var *worldToTangent = getInWorldToTangent(componentList); + Var *wsNormal = getInWorldNormal(componentList); Var *wsView = getWsView(wsPosition, meta); //Reflection Probe WIP diff --git a/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.h b/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.h index 24a2a8115..d4dbb1886 100644 --- a/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.h +++ b/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.h @@ -137,6 +137,7 @@ public: MultiLine *meta ); Var* getSurface(Vector& componentList, MultiLine* meta, const MaterialFeatureData& fd); + Var* getInWorldNormal(Vector& componentList); // ShaderFeature Var* getVertTexCoord( const String &name ); diff --git a/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp b/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp index 80601ad68..0b5f79e4d 100644 --- a/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp +++ b/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp @@ -879,12 +879,10 @@ Var* ShaderFeatureHLSL::getSurface(Vector& componentList, Mult meta->addStatement(new GenOp(" @;\r\n\n", new DecOp(normal))); Var* wsNormal = (Var*)LangElement::find("wsNormal"); - if (!fd.features[MFT_NormalMap]) { if (!wsNormal) wsNormal = getInWorldNormal(componentList); - meta->addStatement(new GenOp(" @ = normalize( @ );\r\n\n", normal, wsNormal)); } else @@ -894,6 +892,14 @@ Var* ShaderFeatureHLSL::getSurface(Vector& componentList, Mult } Var* wsEyePos = (Var*)LangElement::find("eyePosWorld"); + + if (!wsEyePos) + { + wsEyePos = new Var("eyePosWorld", "float3"); + wsEyePos->uniform = true; + wsEyePos->constSortPos = cspPass; + } + Var* wsPosition = getInWsPosition(componentList); Var* wsView = getWsView(wsPosition, meta); @@ -2138,8 +2144,6 @@ RTLightingFeatHLSL::RTLightingFeatHLSL() void RTLightingFeatHLSL::processVert( Vector &componentList, const MaterialFeatureData &fd ) { - if (fd.features[MFT_ImposterVert]) return; - MultiLine *meta = new MultiLine; ShaderConnector *connectComp = dynamic_cast( componentList[C_CONNECTOR] ); @@ -2178,11 +2182,14 @@ void RTLightingFeatHLSL::processVert( Vector &componentList, return; } + addOutWsPosition( componentList, fd.features[MFT_UseInstancing], meta ); + getOutWorldToTangent(componentList, meta, fd); + output = meta; + + // Find the incoming vertex normal. Var *inNormal = (Var*)LangElement::find( "normal" ); - // Skip out on realtime lighting if we don't have a normal - // or we're doing some sort of baked lighting. if ( !inNormal || fd.features[MFT_LightMap] || fd.features[MFT_ToneMap] || @@ -2191,7 +2198,6 @@ void RTLightingFeatHLSL::processVert( Vector &componentList, // If there isn't a normal map then we need to pass // the world space normal to the pixel shader ourselves. - //Temporarily disabled while we figure out how to better handle normals without a normal map if ( !fd.features[MFT_NormalMap] ) { Var *outNormal = connectComp->getElement( RT_TEXCOORD ); @@ -2205,11 +2211,6 @@ void RTLightingFeatHLSL::processVert( Vector &componentList, // Transform the normal to world space. meta->addStatement( new GenOp( " @ = mul( @, float4( normalize( @ ), 0.0 ) ).xyz;\r\n", outNormal, objTrans, inNormal ) ); } - - addOutWsPosition( componentList, fd.features[MFT_UseInstancing], meta ); - getOutWorldToTangent(componentList, meta, fd); - - output = meta; } void RTLightingFeatHLSL::processPix( Vector &componentList, @@ -2229,10 +2230,9 @@ void RTLightingFeatHLSL::processPix( Vector &componentList, MultiLine *meta = new MultiLine; // Now the wsPosition and wsView. - Var* worldToTangent = getInWorldToTangent(componentList); - Var* wsNormal = getInWorldNormal(componentList); Var *wsPosition = getInWsPosition( componentList ); - + Var* worldToTangent = getInWorldToTangent(componentList); + Var* wsNormal = getInWorldNormal(componentList); Var *wsView = getWsView( wsPosition, meta ); // Look for a light mask generated from a previous @@ -2686,7 +2686,7 @@ void FoliageFeatureHLSL::processVert( Vector &componentList, tangent->setType( "float3" ); tangent->setName( "T" ); LangElement *tangentDec = new DecOp( tangent ); - meta->addStatement( new GenOp( " @;\n", tangentDec ) ); + meta->addStatement( new GenOp( " @ = float3(1.0,0,0);\n", tangentDec ) ); // We add a float foliageFade to the OUT structure. ShaderConnector *connectComp = dynamic_cast( componentList[C_CONNECTOR] ); diff --git a/Engine/source/sim/actionMap.cpp b/Engine/source/sim/actionMap.cpp index 40a41aa06..117278aff 100644 --- a/Engine/source/sim/actionMap.cpp +++ b/Engine/source/sim/actionMap.cpp @@ -1962,7 +1962,7 @@ void ContextAction::processTick() if (mActive) { F32 currTime = Sim::getCurrentTime(); - static const char *argv[2]; + static const char *argv[3]; //see if this key even is still active if (!mBreakEvent) diff --git a/Engine/source/sim/actionMap.h b/Engine/source/sim/actionMap.h index 26caffe7b..840dd70f9 100644 --- a/Engine/source/sim/actionMap.h +++ b/Engine/source/sim/actionMap.h @@ -92,7 +92,7 @@ class ActionMap : public SimObject U32 deviceInst; Vector nodeMap; - DeviceMap():deviceType(NULL), deviceInst(NULL){ + DeviceMap():deviceType(0), deviceInst(0){ VECTOR_SET_ASSOCIATION(nodeMap); } ~DeviceMap(); diff --git a/Engine/source/sim/netObject.cpp b/Engine/source/sim/netObject.cpp index 25c5e3657..0a33379ec 100644 --- a/Engine/source/sim/netObject.cpp +++ b/Engine/source/sim/netObject.cpp @@ -407,7 +407,7 @@ DefineEngineMethod( NetObject, getClientObject, S32, (),, if ( obj ) return obj->getId(); - return NULL; + return 0; } //ConsoleMethod( NetObject, getClientObject, S32, 2, 2, "Short-Circuit-Netorking: this is only valid for a local-client / singleplayer situation." ) @@ -439,7 +439,7 @@ DefineEngineMethod( NetObject, getServerObject, S32, (),, if ( obj ) return obj->getId(); - return NULL; + return 0; } //ConsoleMethod( NetObject, getServerObject, S32, 2, 2, "Short-Circuit-Netorking: this is only valid for a local-client / singleplayer situation." ) diff --git a/Engine/source/terrain/glsl/terrFeatureGLSL.cpp b/Engine/source/terrain/glsl/terrFeatureGLSL.cpp index 14f321cce..3b66006ce 100644 --- a/Engine/source/terrain/glsl/terrFeatureGLSL.cpp +++ b/Engine/source/terrain/glsl/terrFeatureGLSL.cpp @@ -281,6 +281,8 @@ void TerrainBaseMapFeatGLSL::processVert( Vector &componentLis Var *squareSize = _getUniformVar( "squareSize", "float", cspPass ); meta->addStatement( new GenOp( " @ = normalize( vec3( @, 0, @ ) );\r\n", new DecOp( inTanget ), squareSize, inTangentZ ) ); + + getOutViewToTangent(componentList, meta, fd); } void TerrainBaseMapFeatGLSL::processPix( Vector &componentList, @@ -304,34 +306,35 @@ void TerrainBaseMapFeatGLSL::processPix( Vector &componentLis baseColor->setName( "baseColor" ); meta->addStatement( new GenOp( " @ = tex2D( @, @.xy );\r\n", new DecOp( baseColor ), diffuseMap, texCoord ) ); - ShaderFeature::OutputTarget target = ShaderFeature::DefaultTarget; + ShaderFeature::OutputTarget target = (fd.features[MFT_isDeferred]) ? RenderTarget1 : DefaultTarget; + meta->addStatement(new GenOp(" @;\r\n", assignColor(baseColor, Material::Mul, NULL, target))); - if(fd.features.hasFeature(MFT_isDeferred)) - { - target= ShaderFeature::RenderTarget1; - } - meta->addStatement( new GenOp( " @;\r\n", assignColor( baseColor, Material::Mul,NULL,target ) ) ); - - // Set base ORM info Var* ormConfig; - OutputTarget targ = RenderTarget1; - if (fd.features[MFT_isDeferred]) + if ((fd.features[MFT_isDeferred])) { - targ = RenderTarget2; + // Set base ORM info + ormConfig = (Var*)LangElement::find(getOutputTargetVarName(RenderTarget2)); + + if (!ormConfig) + { + // create color var + ormConfig = new Var; + ormConfig->setType("fragout"); + ormConfig->setName(getOutputTargetVarName(RenderTarget2)); + ormConfig->setStructName("OUT"); + } } - ormConfig = (Var*)LangElement::find(getOutputTargetVarName(targ)); - if (!ormConfig) + else { - // create color var - ormConfig = new Var; - ormConfig->setType("fragout"); - ormConfig->setName(getOutputTargetVarName(targ)); - ormConfig->setStructName("OUT"); + ormConfig = new Var("ORMConfig", "float4"); + meta->addStatement(new GenOp(" @;\r\n", new DecOp(ormConfig))); } meta->addStatement(new GenOp(" @ = float4(0.0, 1.0, 1.0, 0.0);\r\n", ormConfig)); output = meta; + + Var* viewToTangent = getInViewToTangent(componentList); } ShaderFeature::Resources TerrainBaseMapFeatGLSL::getResources( const MaterialFeatureData &fd ) @@ -347,7 +350,7 @@ ShaderFeature::Resources TerrainBaseMapFeatGLSL::getResources( const MaterialFea U32 TerrainBaseMapFeatGLSL::getOutputTargets( const MaterialFeatureData &fd ) const { - return fd.features[MFT_isDeferred] ? ShaderFeature::RenderTarget1 | ShaderFeature::RenderTarget2 : ShaderFeature::DefaultTarget | ShaderFeature::RenderTarget1; + return fd.features[MFT_isDeferred] ? ShaderFeature::RenderTarget2 | ShaderFeature::RenderTarget1 : ShaderFeature::DefaultTarget; } TerrainDetailMapFeatGLSL::TerrainDetailMapFeatGLSL() @@ -782,6 +785,22 @@ void TerrainMacroMapFeatGLSL::processPix( Vector &componentL meta->addStatement( new GenOp( " @ = calcBlend( @.x, @.xy, @, @ );\r\n", new DecOp( detailBlend ), detailInfo, inTex, layerSize, layerSample ) ); + // Check to see if we have a gbuffer normal. + Var* gbNormal = (Var*)LangElement::find("gbNormal"); + + // If we have a gbuffer normal and we don't have a + // normal map feature then we need to lerp in a + // default normal else the normals below this layer + // will show thru. + if (gbNormal && + !fd.features.hasFeature(MFT_TerrainNormalMap, detailIndex)) + { + Var* viewToTangent = getInViewToTangent(componentList); + + meta->addStatement(new GenOp(" @ = lerp( @, @[2], min( @, @.w ) );\r\n", + gbNormal, gbNormal, viewToTangent, detailBlend, inDet)); + } + Var *detailColor = (Var*)LangElement::find( "macroColor" ); if ( !detailColor ) { @@ -1167,24 +1186,36 @@ void TerrainORMMapFeatGLSL::processPix(Vector &componentList, else texOp = new GenOp("tex2D(@, vec3(@.xy, @.x))", ormConfigMap, inDet, new IndexOp(detailInfo, compositeIndex)); - // search for material var - Var * ormConfig; - OutputTarget targ = RenderTarget1; - if (fd.features[MFT_isDeferred]) - { - targ = RenderTarget2; - } - ormConfig = (Var*)LangElement::find(getOutputTargetVarName(targ)); + MultiLine* meta = new MultiLine; + // search for material var + Var* ormConfig; + if ((fd.features[MFT_isDeferred])) + { + // Set base ORM info + ormConfig = (Var*)LangElement::find(getOutputTargetVarName(RenderTarget2)); - MultiLine * meta = new MultiLine; - if (!ormConfig) - { - // create color var - ormConfig = new Var; - ormConfig->setType("fragout"); - ormConfig->setName(getOutputTargetVarName(targ)); - ormConfig->setStructName("OUT"); - } + if (!ormConfig) + { + // create color var + ormConfig = new Var; + ormConfig->setType("fragout"); + ormConfig->setName(getOutputTargetVarName(RenderTarget2)); + ormConfig->setStructName("OUT"); + } + } + else + { + ormConfig = (Var*)LangElement::find("ORMConfig"); + if (!ormConfig) + { + ormConfig = new Var("ORMConfig", "vec4"); + meta->addStatement(new GenOp(" @;\r\n", new DecOp(ormConfig))); + } + } + if (compositeIndex == 0) + { + meta->addStatement(new GenOp(" @ = vec4(0.0, 0.0, 0.0, 0.0);\r\n", ormConfig)); + } Var *detailBlend = (Var*)LangElement::find(String::ToString("detailBlend%d", compositeIndex)); AssertFatal(detailBlend, "The detail blend is missing!"); @@ -1192,11 +1223,6 @@ void TerrainORMMapFeatGLSL::processPix(Vector &componentList, String matinfoName(String::ToString("matinfoCol%d", compositeIndex)); Var *matinfoCol = new Var(matinfoName, "vec3"); - if (compositeIndex == 0) - { - meta->addStatement(new GenOp(" @ = vec4(0.0, 0.0, 0.0, 0.0);\r\n", ormConfig)); - } - meta->addStatement(new GenOp(" @ = @.rgb;\r\n", new DecOp(matinfoCol), texOp)); if (fd.features.hasFeature(MFT_InvertRoughness, compositeIndex)) @@ -1218,58 +1244,44 @@ void TerrainORMMapFeatGLSL::processPix(Vector &componentList, ShaderFeature::Resources TerrainORMMapFeatGLSL::getResources(const MaterialFeatureData &fd) { Resources res; - - S32 featureIndex = 0, firstOrmMapIndex = 0; - for (int idx = 0; idx < fd.features.getCount(); ++idx) { - const FeatureType& type = fd.features.getAt(idx, &featureIndex); - if (type == MFT_TerrainORMMap) { - firstOrmMapIndex = getMin(firstOrmMapIndex, featureIndex); - } - } - - // We only need to process normals during the deferred. - if (getProcessIndex() == firstOrmMapIndex) - { - res.numTexReg = 1; - res.numTex = 1; - } + res.numTex = 1; return res; } - -U32 TerrainBlankInfoMapFeatGLSL::getOutputTargets(const MaterialFeatureData &fd) const -{ - return fd.features[MFT_isDeferred] ? ShaderFeature::RenderTarget2 : ShaderFeature::RenderTarget1; -} - // reminder, the matinfo buffer is flags, smooth, ao, metal void TerrainBlankInfoMapFeatGLSL::processPix(Vector &componentList, const MaterialFeatureData &fd) { S32 compositeIndex = getProcessIndex(); - // search for material var - Var *material; - OutputTarget targ = DefaultTarget; - if (fd.features[MFT_isDeferred]) + MultiLine* meta = new MultiLine; Var* ormConfig; + if ((fd.features[MFT_isDeferred])) { - targ = RenderTarget2; - } - material = (Var*)LangElement::find(getOutputTargetVarName(targ)); + // Set base ORM info + ormConfig = (Var*)LangElement::find(getOutputTargetVarName(RenderTarget2)); - MultiLine * meta = new MultiLine; - if (!material) + if (!ormConfig) + { + // create color var + ormConfig = new Var; + ormConfig->setType("fragout"); + ormConfig->setName(getOutputTargetVarName(RenderTarget2)); + ormConfig->setStructName("OUT"); + } + } + else { - // create color var - material = new Var; - material->setType("vec4"); - material->setName(getOutputTargetVarName(targ)); - material->setStructName("OUT"); + ormConfig = (Var*)LangElement::find("ORMConfig"); + if (!ormConfig) + { + ormConfig = new Var("ORMConfig", "vec4"); + meta->addStatement(new GenOp(" @;\r\n", new DecOp(ormConfig))); + } } if (compositeIndex == 0) { - meta->addStatement(new GenOp(" @ = vec4(0.0, 0.0, 0.0, 0.0);\r\n", material)); + meta->addStatement(new GenOp(" @ = float4(0.0, 0.0, 0.0, 0.0);\r\n", ormConfig)); } Var* detailBlend = (Var*)LangElement::find(String::ToString("detailBlend%d", compositeIndex)); @@ -1277,7 +1289,10 @@ void TerrainBlankInfoMapFeatGLSL::processPix(Vector &component String matinfoName(String::ToString("matinfoCol%d", compositeIndex)); - meta->addStatement(new GenOp(" @.gba += vec3(@, @, 0.0);\r\n", material, detailBlend, detailBlend)); + if (!fd.features.hasFeature(MFT_TerrainHeightBlend)) + { + meta->addStatement(new GenOp(" @.gba += vec3(@, @, 0.0);\r\n", ormConfig, detailBlend, detailBlend)); + } output = meta; } diff --git a/Engine/source/terrain/glsl/terrFeatureGLSL.h b/Engine/source/terrain/glsl/terrFeatureGLSL.h index 5b48c0a51..7d56a75bf 100644 --- a/Engine/source/terrain/glsl/terrFeatureGLSL.h +++ b/Engine/source/terrain/glsl/terrFeatureGLSL.h @@ -174,7 +174,6 @@ public: virtual void processPix(Vector &componentList, const MaterialFeatureData &fd); - virtual U32 getOutputTargets(const MaterialFeatureData &fd) const; virtual String getName() { return "Blank Matinfo map"; } }; diff --git a/Engine/source/terrain/hlsl/terrFeatureHLSL.cpp b/Engine/source/terrain/hlsl/terrFeatureHLSL.cpp index e136c82eb..362a012a3 100644 --- a/Engine/source/terrain/hlsl/terrFeatureHLSL.cpp +++ b/Engine/source/terrain/hlsl/terrFeatureHLSL.cpp @@ -337,27 +337,27 @@ void TerrainBaseMapFeatHLSL::processVert( Vector &componentLis new DecOp( inTanget ), squareSize, inTangentZ ) ); } -void TerrainBaseMapFeatHLSL::processPix( Vector &componentList, - const MaterialFeatureData &fd ) +void TerrainBaseMapFeatHLSL::processPix(Vector& componentList, + const MaterialFeatureData& fd) { // grab connector texcoord register - Var *texCoord = getInTexCoord( "texCoord", "float3", componentList ); + Var* texCoord = getInTexCoord("texCoord", "float3", componentList); // create texture var - Var *diffuseMap = new Var; - diffuseMap->setType( "SamplerState" ); - diffuseMap->setName( "baseTexMap" ); + Var* diffuseMap = new Var; + diffuseMap->setType("SamplerState"); + diffuseMap->setName("baseTexMap"); diffuseMap->uniform = true; diffuseMap->sampler = true; diffuseMap->constNum = Var::getTexUnitNum(); // used as texture unit num here - MultiLine *meta = new MultiLine; + MultiLine* meta = new MultiLine; - Var *baseColor = new Var; - baseColor->setType( "float4" ); - baseColor->setName( "baseColor" ); + Var* baseColor = new Var; + baseColor->setType("float4"); + baseColor->setName("baseColor"); - Var *diffuseTex = new Var; + Var* diffuseTex = new Var; diffuseTex->setType("Texture2D"); diffuseTex->setName("baseTexture"); diffuseTex->uniform = true; @@ -365,33 +365,31 @@ void TerrainBaseMapFeatHLSL::processPix( Vector &componentLis diffuseTex->constNum = diffuseMap->constNum; meta->addStatement(new GenOp(" @ = @.Sample( @, @.xy );\r\n", new DecOp(baseColor), diffuseTex, diffuseMap, texCoord)); - ShaderFeature::OutputTarget target = ShaderFeature::DefaultTarget; + ShaderFeature::OutputTarget target = (fd.features[MFT_isDeferred]) ? RenderTarget1 : DefaultTarget; + meta->addStatement(new GenOp(" @;\r\n", assignColor(baseColor, Material::Mul, NULL, target))); - if (fd.features.hasFeature(MFT_isDeferred)) - { - target= ShaderFeature::RenderTarget1; - } - - meta->addStatement( new GenOp( " @;\r\n", assignColor( baseColor, Material::Mul,NULL,target ) ) ); - - if (fd.features[MFT_isDeferred]) + Var* ormConfig; + if ((fd.features[MFT_isDeferred])) { // Set base ORM info - Var* ormConfig; - OutputTarget targ = RenderTarget1; - targ = RenderTarget2; - ormConfig = (Var*)LangElement::find(getOutputTargetVarName(targ)); + ormConfig = (Var*)LangElement::find(getOutputTargetVarName(RenderTarget2)); + if (!ormConfig) { // create color var ormConfig = new Var; ormConfig->setType("fragout"); - ormConfig->setName(getOutputTargetVarName(targ)); + ormConfig->setName(getOutputTargetVarName(RenderTarget2)); ormConfig->setStructName("OUT"); } - - meta->addStatement(new GenOp(" @ = float4(0.0, 1.0, 1.0, 0.0);\r\n", ormConfig)); } + else + { + ormConfig = new Var("ORMConfig", "float4"); + meta->addStatement(new GenOp(" @;\r\n", new DecOp(ormConfig))); + } + + meta->addStatement(new GenOp(" @ = float4(0.0, 1.0, 1.0, 0.0);\r\n", ormConfig)); output = meta; } @@ -407,7 +405,7 @@ ShaderFeature::Resources TerrainBaseMapFeatHLSL::getResources( const MaterialFea U32 TerrainBaseMapFeatHLSL::getOutputTargets( const MaterialFeatureData &fd ) const { - return fd.features[MFT_isDeferred] ? ShaderFeature::RenderTarget1 | ShaderFeature::RenderTarget2 : ShaderFeature::DefaultTarget; + return fd.features[MFT_isDeferred] ? ShaderFeature::RenderTarget2 | ShaderFeature::RenderTarget1 : ShaderFeature::DefaultTarget; } TerrainDetailMapFeatHLSL::TerrainDetailMapFeatHLSL() @@ -1259,23 +1257,35 @@ void TerrainORMMapFeatHLSL::processPix(Vector &componentList, else texOp = new GenOp("@.Sample(@, float3(@.xy, @.x))", ormMapArray, ormMapSampler, inDet, new IndexOp(detailInfo, compositeIndex)); + MultiLine* meta = new MultiLine; // search for material var - Var * ormConfig; - OutputTarget targ = RenderTarget1; - if (fd.features[MFT_isDeferred]) + Var* ormConfig; + if ((fd.features[MFT_isDeferred])) { - targ = RenderTarget2; - } - ormConfig = (Var*)LangElement::find(getOutputTargetVarName(targ)); + // Set base ORM info + ormConfig = (Var*)LangElement::find(getOutputTargetVarName(RenderTarget2)); - MultiLine * meta = new MultiLine; - if (!ormConfig) + if (!ormConfig) + { + // create color var + ormConfig = new Var; + ormConfig->setType("fragout"); + ormConfig->setName(getOutputTargetVarName(RenderTarget2)); + ormConfig->setStructName("OUT"); + } + } + else { - // create color var - ormConfig = new Var; - ormConfig->setType("fragout"); - ormConfig->setName(getOutputTargetVarName(targ)); - ormConfig->setStructName("OUT"); + ormConfig = (Var*)LangElement::find("ORMConfig"); + if (!ormConfig) + { + ormConfig = new Var("ORMConfig", "float4"); + meta->addStatement(new GenOp(" @;\r\n", new DecOp(ormConfig))); + } + } + if (compositeIndex == 0) + { + meta->addStatement(new GenOp(" @ = float4(0.0, 0.0, 0.0, 0.0);\r\n", ormConfig)); } Var *detailBlend = (Var*)LangElement::find(String::ToString("detailBlend%d", compositeIndex)); @@ -1284,11 +1294,6 @@ void TerrainORMMapFeatHLSL::processPix(Vector &componentList, String matinfoName(String::ToString("matinfoCol%d", compositeIndex)); Var *matinfoCol = new Var(matinfoName, "float3"); - if (compositeIndex == 0) - { - meta->addStatement(new GenOp(" @ = float4(0.0, 0.0, 0.0, 0.0);\r\n", ormConfig)); - } - meta->addStatement(new GenOp(" @ = @.rgb;\r\n", new DecOp(matinfoCol), texOp)); if (fd.features.hasFeature(MFT_InvertRoughness, compositeIndex)) @@ -1313,39 +1318,39 @@ ShaderFeature::Resources TerrainORMMapFeatHLSL::getResources(const MaterialFeatu return res; } -// reminder, the matinfo buffer is flags, smooth, ao, metal -U32 TerrainBlankInfoMapFeatHLSL::getOutputTargets(const MaterialFeatureData &fd) const -{ - return fd.features[MFT_isDeferred] ? ShaderFeature::RenderTarget2 : ShaderFeature::RenderTarget1; -} - void TerrainBlankInfoMapFeatHLSL::processPix(Vector &componentList, const MaterialFeatureData &fd) { S32 compositeIndex = getProcessIndex(); - // search for material var - Var *material; - OutputTarget ormConfig = RenderTarget1; - if (fd.features[MFT_isDeferred]) + MultiLine * meta = new MultiLine; Var* ormConfig; + if ((fd.features[MFT_isDeferred])) { - ormConfig = RenderTarget2; - } - material = (Var*)LangElement::find(getOutputTargetVarName(ormConfig)); + // Set base ORM info + ormConfig = (Var*)LangElement::find(getOutputTargetVarName(RenderTarget2)); - MultiLine * meta = new MultiLine; - if (!material) + if (!ormConfig) + { + // create color var + ormConfig = new Var; + ormConfig->setType("fragout"); + ormConfig->setName(getOutputTargetVarName(RenderTarget2)); + ormConfig->setStructName("OUT"); + } + } + else { - // create color var - material = new Var; - material->setType("fragout"); - material->setName(getOutputTargetVarName(ormConfig)); - material->setStructName("OUT"); + ormConfig = (Var*)LangElement::find("ORMConfig"); + if (!ormConfig) + { + ormConfig = new Var("ORMConfig", "float4"); + meta->addStatement(new GenOp(" @;\r\n", new DecOp(ormConfig))); + } } if (compositeIndex == 0) { - meta->addStatement(new GenOp(" @ = float4(0.0, 0.0, 0.0, 0.0);\r\n", material)); + meta->addStatement(new GenOp(" @ = float4(0.0, 0.0, 0.0, 0.0);\r\n", ormConfig)); } Var* detailBlend = (Var*)LangElement::find(String::ToString("detailBlend%d", compositeIndex)); @@ -1355,7 +1360,7 @@ void TerrainBlankInfoMapFeatHLSL::processPix(Vector &component if (!fd.features.hasFeature(MFT_TerrainHeightBlend)) { - meta->addStatement(new GenOp(" @.gba += float3(@, @, 0.0);\r\n", material, detailBlend, detailBlend)); + meta->addStatement(new GenOp(" @.gba += float3(@, @, 0.0);\r\n", ormConfig, detailBlend, detailBlend)); } output = meta; diff --git a/Engine/source/terrain/hlsl/terrFeatureHLSL.h b/Engine/source/terrain/hlsl/terrFeatureHLSL.h index 829af9c6f..f3803f2d9 100644 --- a/Engine/source/terrain/hlsl/terrFeatureHLSL.h +++ b/Engine/source/terrain/hlsl/terrFeatureHLSL.h @@ -179,8 +179,6 @@ public: virtual void processPix(Vector &componentList, const MaterialFeatureData &fd); - - virtual U32 getOutputTargets(const MaterialFeatureData &fd) const; virtual String getName() { return "Blank Matinfo map"; } }; diff --git a/Engine/source/terrain/terrCellMaterial.cpp b/Engine/source/terrain/terrCellMaterial.cpp index ff34a65ac..5f6eefd08 100644 --- a/Engine/source/terrain/terrCellMaterial.cpp +++ b/Engine/source/terrain/terrCellMaterial.cpp @@ -615,8 +615,6 @@ bool TerrainCellMaterial::_initShader(bool deferredMat, mOrmTexArrayConst = mShader->getShaderConstHandle("$ormMapSampler"); if (mOrmTexArrayConst->isValid()) { - GFXTextureProfile* profile = &GFXStaticTextureProfile; - const S32 sampler = mOrmTexArrayConst->getSamplerRegister(); desc.samplers[sampler] = GFXSamplerStateDesc::getWrapLinear(); diff --git a/Engine/source/terrain/terrData.cpp b/Engine/source/terrain/terrData.cpp index be43d6638..532e0cc19 100644 --- a/Engine/source/terrain/terrData.cpp +++ b/Engine/source/terrain/terrData.cpp @@ -992,8 +992,6 @@ void TerrainBlock::addMaterial( const String &name, U32 insertAt ) mFile->mMaterials.push_back( mat ); mFile->_initMaterialInstMapping(); - bool isSrv = isServerObject(); - //now we update our asset if (mTerrainAsset) { @@ -1418,7 +1416,7 @@ void TerrainBlock::unpackUpdate(NetConnection* con, BitStream *stream) char buffer[256]; stream->readString(buffer); - bool validAsset = setTerrainAsset(StringTable->insert(buffer)); + setTerrainAsset(StringTable->insert(buffer)); } if (baseTexSizeChanged && isProperlyAdded()) _updateBaseTexture(NONE); diff --git a/Engine/source/ts/tsCollision.cpp b/Engine/source/ts/tsCollision.cpp index 53fcb60d6..22381436b 100644 --- a/Engine/source/ts/tsCollision.cpp +++ b/Engine/source/ts/tsCollision.cpp @@ -1044,9 +1044,9 @@ PhysicsCollision* TSShape::_buildColShapes( bool useVisibleMesh, const Point3F & // We need the default mesh transform. MatrixF localXfm; getNodeWorldTransform( object.nodeIndex, &localXfm ); - Point3F t = localXfm.getPosition(); - t.convolve(scale); - localXfm.setPosition(t); + Point3F nodeWorldPosition = localXfm.getPosition(); + nodeWorldPosition.convolve(scale); + localXfm.setPosition(nodeWorldPosition); // We have some sort of collision shape... so allocate it. if ( !colShape ) @@ -1061,9 +1061,9 @@ PhysicsCollision* TSShape::_buildColShapes( bool useVisibleMesh, const Point3F & // Add the offset to the center of the bounds // into the local space transform. MatrixF centerXfm( true ); - Point3F t = mesh->getBounds().getCenter(); - t.convolve(scale); - centerXfm.setPosition(t); + Point3F meshBoundsCenter = mesh->getBounds().getCenter(); + meshBoundsCenter.convolve(scale); + centerXfm.setPosition(meshBoundsCenter); localXfm.mul( centerXfm ); colShape->addBox( halfWidth, localXfm ); @@ -1077,9 +1077,9 @@ PhysicsCollision* TSShape::_buildColShapes( bool useVisibleMesh, const Point3F & // Add the offset to the center of the bounds // into the local space transform. MatrixF primXfm( true ); - Point3F t = mesh->getBounds().getCenter(); - t.convolve(scale); - primXfm.setPosition(t); + Point3F meshBoundsCenter = mesh->getBounds().getCenter(); + meshBoundsCenter.convolve(scale); + primXfm.setPosition(meshBoundsCenter); localXfm.mul( primXfm ); colShape->addSphere( radius, localXfm ); @@ -1092,9 +1092,9 @@ PhysicsCollision* TSShape::_buildColShapes( bool useVisibleMesh, const Point3F & // We need to center the capsule and align it to the Y axis. MatrixF primXfm( true ); - Point3F t = mesh->getBounds().getCenter(); - t.convolve(scale); - primXfm.setPosition(t); + Point3F meshBoundsCenter = mesh->getBounds().getCenter(); + meshBoundsCenter.convolve(scale); + primXfm.setPosition(meshBoundsCenter); // Use the longest axis as the capsule height. F32 height = -radius * 2.0f; diff --git a/Engine/source/ts/tsShape.cpp b/Engine/source/ts/tsShape.cpp index b3026a98a..36825014b 100644 --- a/Engine/source/ts/tsShape.cpp +++ b/Engine/source/ts/tsShape.cpp @@ -74,7 +74,7 @@ TSShape::TSShape() mRadius = 0; mFlags = 0; tubeRadius = 0; - data = NULL; + data = 0; materialList = NULL; mReadVersion = -1; // -1 means constructed from scratch (e.g., in exporter or no read yet) mSequencesConstructed = false; @@ -225,11 +225,7 @@ const String& TSShape::getTargetName( S32 mapToNameIndex ) const S32 TSShape::getTargetCount() const { - if(!this) - return -1; - return materialList->getMaterialNameList().size(); - } S32 TSShape::findNode(S32 nameIndex) const diff --git a/Engine/source/ts/tsShapeConstruct.cpp b/Engine/source/ts/tsShapeConstruct.cpp index 08dbc21c2..6f53670b8 100644 --- a/Engine/source/ts/tsShapeConstruct.cpp +++ b/Engine/source/ts/tsShapeConstruct.cpp @@ -357,7 +357,7 @@ void TSShapeConstructor::initPersistFields() endGroup("Collada"); addGroup("Sequences"); - addProtectedField("sequence", TypeStringFilename, NULL, &addSequenceFromField, &emptyStringProtectedGetFn, + addProtectedField("sequence", TypeStringFilename, 0, &addSequenceFromField, &emptyStringProtectedGetFn, "Legacy method of adding sequences to a DTS or DAE shape after loading.\n\n" "@tsexample\n" "singleton TSShapeConstructor(MyShapeDae)\n" diff --git a/Engine/source/windowManager/sdl/sdlWindow.cpp b/Engine/source/windowManager/sdl/sdlWindow.cpp index 2c725a2d1..6b420d080 100644 --- a/Engine/source/windowManager/sdl/sdlWindow.cpp +++ b/Engine/source/windowManager/sdl/sdlWindow.cpp @@ -550,7 +550,7 @@ void PlatformWindowSDL::_triggerTextNotify(const SDL_Event& evt) } else // get a wchar string { - const U32 len = strlen(evt.text.text); + const dsize_t len = strlen(evt.text.text); U16 wchar[16] = {}; dMemcpy(wchar, evt.text.text, sizeof(char)*len); diff --git a/Templates/BaseGame/game/core/rendering/scripts/renderManager.tscript b/Templates/BaseGame/game/core/rendering/scripts/renderManager.tscript index 1eefa6cf5..8c024c222 100644 --- a/Templates/BaseGame/game/core/rendering/scripts/renderManager.tscript +++ b/Templates/BaseGame/game/core/rendering/scripts/renderManager.tscript @@ -59,8 +59,8 @@ function initRenderManager() DiffuseRenderPassManager.addManager( new RenderObjectMgr(ObjectBin) { bintype = "Object"; renderOrder = 0.6; processAddOrder = 0.6; } ); DiffuseRenderPassManager.addManager( new RenderObjectMgr(ShadowBin) { bintype = "Shadow"; renderOrder = 0.7; processAddOrder = 0.7; } ); - DiffuseRenderPassManager.addManager( new RenderMeshMgr(DecalRoadBin) { bintype = "DecalRoad"; renderOrder = 0.8; processAddOrder = 0.8; basicOnly = true;} ); - DiffuseRenderPassManager.addManager( new RenderMeshMgr(DecalBin) { bintype = "Decal"; renderOrder = 0.81; processAddOrder = 0.81; basicOnly = true;} ); + DiffuseRenderPassManager.addManager( new RenderMeshMgr(DecalRoadBin) { bintype = "DecalRoad"; renderOrder = 0.8; processAddOrder = 0.8; } ); + DiffuseRenderPassManager.addManager( new RenderMeshMgr(DecalBin) { bintype = "Decal"; renderOrder = 0.81; processAddOrder = 0.81;} ); DiffuseRenderPassManager.addManager( new RenderOcclusionMgr(OccluderBin){ bintype = "Occluder"; renderOrder = 0.9; processAddOrder = 0.9; } ); // Render the sky last diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/torque.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/torque.glsl index 5482bdaf3..4ec0303aa 100644 --- a/Templates/BaseGame/game/core/rendering/shaders/gl/torque.glsl +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/torque.glsl @@ -291,8 +291,8 @@ void fizzle(vec2 vpos, float visibility) // I'm sure there are many more patterns here to // discover for different effects. - mat2x2 m = mat2x2( vpos.x, vpos.y, 0.916, 0.350 ); - if( (visibility - fract( determinant( m ) )) < 0 ) //if(a < 0) discard; + mat2x2 m = mat2x2( vpos.x, 0.916, vpos.y, 0.350 ); + if( (visibility - fract( determinant( m ) )) < 0 ) discard; } #endif //TORQUE_PIXEL_SHADER diff --git a/Templates/BaseGame/game/core/utility/scripts/module.tscript b/Templates/BaseGame/game/core/utility/scripts/module.tscript index a895f99bf..1f6a755d1 100644 --- a/Templates/BaseGame/game/core/utility/scripts/module.tscript +++ b/Templates/BaseGame/game/core/utility/scripts/module.tscript @@ -4,8 +4,7 @@ if (!isObject(ExecFilesList)) new ArrayObject(ExecFilesList); function callOnModules(%functionName, %moduleGroup, %var0, %var1, %var2, %var3, %var4, %var5, %var6) -{ - %maxvars = 7; // match this to i/o signature +{ //clear per module group file execution chain ExecFilesList.empty(); //Get our modules so we can exec any specific client-side loading/handling @@ -19,22 +18,9 @@ function callOnModules(%functionName, %moduleGroup, %var0, %var1, %var2, %var3, if(%module.group !$= %moduleGroup) continue; } - + // match this to i/o signature if(isObject(%module.scopeSet) && %module.scopeSet.isMethod(%functionName)) - { - %stryng = %module.scopeSet @ "." @ %functionName @ "("; - for (%a=0;%a<%maxvars;%a++) - { - if (%var[%a] !$= "") - { - %stryng = %stryng @ %var[%a]; - if (%a<%maxvars-1 && %var[%a+1] !$= "") - %stryng = %stryng @ ","; - } - } - %stryng = %stryng @ ");"; - eval(%stryng); - } + %module.scopeSet.call(%functionName, %var0, %var1, %var2, %var3, %var4, %var5, %var6); } %execFilecount = ExecFilesList.count(); diff --git a/Templates/BaseGame/game/data/ExampleModule/levels/ExampleLevel.mis b/Templates/BaseGame/game/data/ExampleModule/levels/ExampleLevel.mis index ba5384a96..e2b9ce7d1 100644 --- a/Templates/BaseGame/game/data/ExampleModule/levels/ExampleLevel.mis +++ b/Templates/BaseGame/game/data/ExampleModule/levels/ExampleLevel.mis @@ -36,7 +36,7 @@ new Scene(EditorTemplateLevel) { squareSize = "128"; scaleU = "25"; scaleV = "25"; - MaterialFile = "FloorGray"; + MaterialAsset = "Prototyping:FloorGray"; canSave = "1"; canSaveDynamicFields = "1"; Enabled = "1"; diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript index 747d3e86d..660577c78 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript @@ -1802,7 +1802,7 @@ function matchesSearch(%assetName, %assetType) } else { - if(%assetName.tags !$= %word) + if(strstr(strlwr(%assetName.tags), strlwr(%word)) != -1) %matchTags = true; } } diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/creator.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/creator.tscript index 48366f453..8971087c5 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/creator.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/creator.tscript @@ -174,7 +174,7 @@ function AssetBrowser::addCreatorClass(%this, %class, %name, %buildfunc) %method = "build" @ %class; if( !ObjectBuilderGui.isMethod( %method ) ) - %cmd = "return new " @ %class @ "();"; + %cmd = "new " @ %class @ "();"; else %cmd = "ObjectBuilderGui." @ %method @ "();"; @@ -187,4 +187,4 @@ function AssetBrowser::addCreatorClass(%this, %class, %name, %buildfunc) %args.val[2] = %buildfunc; %this.creatorClassArray.push_back( %group, %args ); -} \ No newline at end of file +} diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/directoryHandling.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/directoryHandling.tscript index 3eb822f21..4f13dfb8b 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/directoryHandling.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/directoryHandling.tscript @@ -216,7 +216,7 @@ function directoryHandler::getFolderTreeItemFromAddress(%this, %address) //break down the address %folderCount = getTokenCount(%address, "/"); - if(startsWith(%address, "Data/") || startsWith(%address, "Tools/") || startsWith(%address, "Core/")) + if(startsWith(%address, "data/") || startsWith(%address, "tools/") || startsWith(%address, "core/")) { %curItem = %this.treeCtrl.findChildItemByName(1, "Modules"); } @@ -242,7 +242,7 @@ function directoryHandler::expandTreeToAddress(%this, %address) %rootId = AssetBrowser-->filterTree.findItemByName("Content"); %this.treeCtrl.expandItem(%rootId); - if(startsWith(%address, "Data/") || startsWith(%address, "Tools/") || startsWith(%address, "Core/")) + if(startsWith(%address, "data/") || startsWith(%address, "tools/") || startsWith(%address, "core/")) { %curItem = %this.treeCtrl.findChildItemByName(1, "Modules"); } diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/selectPath.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/selectPath.tscript index 691a546e0..7db32c752 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/selectPath.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/selectPath.tscript @@ -22,7 +22,7 @@ function SelectAssetPath::showDialog(%this, %startingPath, %callback, %promptTex %this.callback = %callback; %dataItem = SelectAssetPath-->folderTree.insertItem(0, "Data"); - %this.dirHandler.loadFolders("Data", %dataItem); + %this.dirHandler.loadFolders("data", %dataItem); %this.dirHandler.expandTreeToAddress(%startingPath); %id = %this.dirHandler.getFolderTreeItemFromAddress(%startingPath); @@ -60,4 +60,4 @@ function SelectAssetPath::newFolder(%this) { AssetBrowser_newFolderNameTxt.text = "NewFolder"; Canvas.pushDialog(AssetBrowser_newFolder); -} \ No newline at end of file +} diff --git a/Templates/Modules/inputTest/inputTest.tscript b/Templates/Modules/inputTest/inputTest.tscript index 7dad50618..07f27fc9f 100644 --- a/Templates/Modules/inputTest/inputTest.tscript +++ b/Templates/Modules/inputTest/inputTest.tscript @@ -4,6 +4,11 @@ function inputTest::create( %this ) { + // If addToMainMenu is true, a button to display the input monitor will be + // added to the MainMenu gui. If false, you will need to call + // "$GameCanvas.pushDialog(InputMonitorDlg);" from the console or add a + // shortcut somewhere else to access the Input Event Monitor. + %this.addToMainMenu = true; } function inputTest::destroy( %this ) @@ -13,12 +18,12 @@ function inputTest::destroy( %this ) function inputTest::initClient( %this ) { - %this.queueExec("/scripts/customProfiles." @ $TorqueScriptFileExtension); - %this.queueExec("/scripts/inputMonitor." @ $TorqueScriptFileExtension); - %this.queueExec("/scripts/gui/inputMonitor.gui"); - %this.queueExec("/scripts/joystickSettings." @ $TorqueScriptFileExtension); - %this.queueExec("/scripts/gui/joystickSettings.gui"); - %this.queueExec("/scripts/menuButtons." @ $TorqueScriptFileExtension); + %this.queueExec("./scripts/customProfiles." @ $TorqueScriptFileExtension); + %this.queueExec("./scripts/inputMonitor." @ $TorqueScriptFileExtension); + %this.queueExec("./scripts/gui/inputMonitor.gui"); + %this.queueExec("./scripts/joystickSettings." @ $TorqueScriptFileExtension); + %this.queueExec("./scripts/gui/joystickSettings.gui"); + %this.queueExec("./scripts/menuButtons." @ $TorqueScriptFileExtension); } function onSDLDeviceConnected(%sdlIndex, %deviceName, %deviceType) diff --git a/Templates/Modules/inputTest/scripts/gui/inputMonitor.gui b/Templates/Modules/inputTest/scripts/gui/inputMonitor.gui index 67708cf2e..c695016af 100644 --- a/Templates/Modules/inputTest/scripts/gui/inputMonitor.gui +++ b/Templates/Modules/inputTest/scripts/gui/inputMonitor.gui @@ -55,7 +55,7 @@ $guiContent = new GuiControl(InputMonitorDlg) { canSaveDynamicFields = "0"; }; new GuiChunkedBitmapCtrl() { - bitmap = "data/ui/art/hudfill.png"; + bitmap = "data/ui/images/hudfill.png"; useVariable = "0"; tile = "0"; position = "0 0"; diff --git a/Templates/Modules/inputTest/scripts/menuButtons.tscript b/Templates/Modules/inputTest/scripts/menuButtons.tscript index 471676a07..8f97d2262 100644 --- a/Templates/Modules/inputTest/scripts/menuButtons.tscript +++ b/Templates/Modules/inputTest/scripts/menuButtons.tscript @@ -2,6 +2,8 @@ // Add buttons to the MainMenu after all other scripts have been exec'ed. //----------------------------------------------------------------------------- +function inputTest::addMenuButton( %this ) +{ if (isObject(MainMenuGui)) { %testBtn = new GuiButtonCtrl() { @@ -56,4 +58,8 @@ } MMTestContainer.add(%testBtn); - } \ No newline at end of file + } +} + +if (inputTest.addToMainMenu) + inputTest.addMenuButton(); \ No newline at end of file