Merge branch 'Preview4_0' into SoundAssetImplements

# Conflicts:
#	Engine/source/T3D/assets/assetImporter.cpp
#	Engine/source/forest/forestItem.cpp
This commit is contained in:
AzaezelX 2021-10-11 20:11:27 -05:00
commit f5600826d7
122 changed files with 686 additions and 577 deletions

View file

@ -195,7 +195,7 @@ private:
daeRawRefCache rawRefCache;
daeSidRefCache sidRefCache;
std::auto_ptr<charEncoding> localCharEncoding;
std::unique_ptr<charEncoding> localCharEncoding;
static charEncoding globalCharEncoding;
};

View file

@ -60,7 +60,7 @@ public:
private:
static daeErrorHandler *_instance;
static std::auto_ptr<daeErrorHandler> _defaultInstance;
static std::unique_ptr<daeErrorHandler> _defaultInstance;
};
#endif

View file

@ -12,7 +12,7 @@
*/
#ifndef __DAE_STANDARD_URI_RESOLVER__
#define __DAE_STANDARD_URI_RESOVLER__
#define __DAE_STANDARD_URI_RESOLVER__
#include <string>
#include "dae/daeURI.h"

View file

@ -15,7 +15,7 @@
#include <modules/stdErrPlugin.h>
daeErrorHandler *daeErrorHandler::_instance = NULL;
std::auto_ptr<daeErrorHandler> daeErrorHandler::_defaultInstance(new stdErrPlugin);
std::unique_ptr<daeErrorHandler> daeErrorHandler::_defaultInstance(new stdErrPlugin);
daeErrorHandler::daeErrorHandler() {
}

View file

@ -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

View file

@ -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;

View file

@ -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");

View file

@ -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;

View file

@ -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;

View file

@ -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))

View file

@ -74,6 +74,7 @@ public:
enum MaterialAssetErrCode
{
ScriptLoaded = AssetErrCode::Extended,
DefinitionAlreadyExists,
Extended
};

View file

@ -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, (), ,

View file

@ -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

View file

@ -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

View file

@ -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))

View file

@ -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; }

View file

@ -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();

View file

@ -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();
}

View file

@ -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++ )
{
//

View file

@ -807,7 +807,7 @@ bool GameConnection::isValidControlCameraFov(F32 fov)
return cObj->isValidCameraFov(fov);
}
return NULL;
return false;
}
bool GameConnection::setControlCameraFov(F32 fov)

View file

@ -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");

View file

@ -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;

View file

@ -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) {

View file

@ -56,7 +56,7 @@ class afxAnimCurve
public:
afxAnimCurve();
~afxAnimCurve();
virtual ~afxAnimCurve();
void addKey( Point2F &v );
void addKey( F32 time, F32 value );

View file

@ -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;

View file

@ -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);
};

View file

@ -87,7 +87,7 @@ class OptimizedPolyList : public AbstractPolyList
Poly()
: plane( -1 ),
material( NULL ),
material( 0 ),
vertexStart(0),
vertexCount( 0 ),
surfaceKey(0),

View file

@ -76,7 +76,7 @@ public:
Collision()
{
object = NULL;
material = NULL;
material = 0;
distance = 0.0;
}
};

View file

@ -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];
}

View file

@ -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() );

View file

@ -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();

View file

@ -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;
}

View file

@ -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];

View file

@ -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." );

View file

@ -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"(

View file

@ -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

View file

@ -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;

View file

@ -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

View file

@ -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);
}

View file

@ -278,7 +278,6 @@ void CloudLayer::unpackUpdate( NetConnection *conn, BitStream *stream )
stream->read( &mBaseColor );
F32 oldCoverage = mCoverage;
stream->read( &mCoverage );
stream->read( &mExposure );

View file

@ -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" );

View file

@ -1757,7 +1757,7 @@ DefineEngineMethod( GuiMeshRoadEditorCtrl, getSelectedRoad, S32, (), , "" )
{
MeshRoad *road = object->getSelectedRoad();
if ( !road )
return NULL;
return 0;
return road->getId();
}

View file

@ -1472,7 +1472,7 @@ DefineEngineMethod( GuiRiverEditorCtrl, getSelectedRiver, S32, (), , "" )
{
River *river = object->getSelectedRiver();
if ( !river )
return NULL;
return 0;
return river->getId();
}

View file

@ -1097,7 +1097,7 @@ DefineEngineMethod( GuiRoadEditorCtrl, getSelectedRoad, S32, (), , "" )
if ( road )
return road->getId();
return NULL;
return 0;
}
DefineEngineMethod( GuiRoadEditorCtrl, getSelectedNode, S32, (), , "" )

View file

@ -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;

View file

@ -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" );

View file

@ -190,8 +190,6 @@ void ForestItemData::unpackData(BitStream* stream)
stream->read( &localName );
setInternalName( localName );
char readBuffer[1024];
UNPACKDATA_ASSET(Shape);
mCollidable = stream->readFlag();

View file

@ -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");

View file

@ -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 );

View file

@ -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;

View file

@ -308,7 +308,7 @@ U8* GFXGLCubemap::getTextureData(U32 face, U32 mip)
GFXGLCubemapArray::GFXGLCubemapArray()
{
mCubemap = NULL;
mCubemap = 0;
}
GFXGLCubemapArray::~GFXGLCubemapArray()

View file

@ -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;
}

View file

@ -562,6 +562,7 @@ void GFXGLShader::initConstantDescs()
if(!maxNameLength)
return;
maxNameLength++;
FrameTemp<GLchar> uniformName(maxNameLength);

View file

@ -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);

View file

@ -6,7 +6,7 @@
GFXGLTextureArray::GFXGLTextureArray()
{
mTextureArray = NULL;
mTextureArray = 0;
}
void GFXGLTextureArray::init()

View file

@ -13,7 +13,7 @@ public:
~GFXGLTextureArray() { Release(); };
void init();
void init() override;
void setToTexUnit(U32 tuNum) override;

View file

@ -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));

View file

@ -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
}
}

View file

@ -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);
}

View file

@ -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;

View file

@ -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)))

View file

@ -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<GuiPopUpMenuCtrl*>(obj);
object->setBitmap(data);

View file

@ -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<GuiPopUpMenuCtrlEx*>(obj);
object->setBitmap(data);

View file

@ -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),,

View file

@ -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

View file

@ -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();
}

View file

@ -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" );

View file

@ -102,8 +102,6 @@ void GuiRenderTargetVizCtrl::onRender(Point2I offset,
camObject = dynamic_cast<Camera*>(camObject->getClientObject());
bool servObj = camObject->isServerObject();
if (camObject)
{
GFXTexHandle targ = camObject->getCameraRenderTarget();

View file

@ -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)
{
}

View file

@ -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)
{
}

View file

@ -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)
{
}

View file

@ -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;

View file

@ -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 );

View file

@ -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

View file

@ -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 ||

View file

@ -218,7 +218,7 @@ Material::Material()
mPlanarReflection = false;
mCubemapData = NULL;
mDynamicCubemap = NULL;
mDynamicCubemap = false;
mLastUpdateTime = 0;

View file

@ -1290,16 +1290,9 @@ void ProcessedShaderMaterial::setCustomShaderData(Vector<CustomShaderBindingData
for (U32 i = 0; i < shaderData.size(); i++)
{
for (U32 h = 0; h < handles->mCustomHandles.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())

View file

@ -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)

View file

@ -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), ,

View file

@ -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;
}

View file

@ -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)
{
}

View file

@ -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.

View file

@ -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();

View file

@ -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;

View file

@ -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

View file

@ -23,6 +23,7 @@
#ifndef INCLUDED_TYPES_VISUALC_H
#define INCLUDED_TYPES_VISUALC_H
#include <stdlib.h>
// 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

View file

@ -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) ) );
}

View file

@ -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);

View file

@ -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 <stdlib.h>
@ -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);
}

View file

@ -141,7 +141,7 @@ GFXTextureObject* PostEffectManager::getBackBufferTex()
mBackBufferCopyTex.set( targetSize.x, targetSize.y,
targetFormat,
&PostFxTargetProfile, "mBackBufferCopyTex" );
&PostFxTextureSRGBProfile, "mBackBufferCopyTex" );
target->resolveTo( mBackBufferCopyTex );
mLastBackBufferTarget = target;

View file

@ -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++ )
{
//

View file

@ -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();
}

View file

@ -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)

View file

@ -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 );

View file

@ -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;
}
}

View file

@ -474,25 +474,11 @@ Var* ShaderFeatureGLSL::getInVpos( MultiLine *meta,
return inVpos;
ShaderConnector *connectComp = dynamic_cast<ShaderConnector*>( 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<ShaderComponent*> &componentList )
@ -779,6 +765,21 @@ Var* ShaderFeatureGLSL::getWsView( Var *wsPosition, MultiLine *meta )
return wsView;
}
Var* ShaderFeatureGLSL::getInWorldNormal(Vector<ShaderComponent*>& componentList)
{
Var* wsNormal = (Var*)LangElement::find("wsNormal");
if (!wsNormal)
{
ShaderConnector* connectComp = dynamic_cast<ShaderConnector*>(componentList[C_CONNECTOR]);
wsNormal = connectComp->getElement(RT_TEXCOORD);
wsNormal->setName("wsNormal");
wsNormal->setStructName("IN");
wsNormal->setType("float3");
}
return wsNormal;
}
Var* ShaderFeatureGLSL::addOutDetailTexCoord( Vector<ShaderComponent*> &componentList,
MultiLine *meta,
bool useTexAnim,
@ -865,21 +866,23 @@ Var* ShaderFeatureGLSL::getSurface(Vector<ShaderComponent*>& 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<ShaderComponent*> &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<ShaderComponent*> &componentList,
const MaterialFeatureData &fd )
{
if (fd.features[MFT_ImposterVert]) return;
MultiLine *meta = new MultiLine;
ShaderConnector *connectComp = dynamic_cast<ShaderConnector *>( componentList[C_CONNECTOR] );
@ -2104,12 +2107,15 @@ void RTLightingFeatGLSL::processVert( Vector<ShaderComponent*> &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<ShaderComponent*> &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<ShaderComponent*> &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<ShaderComponent*> &componentList,
@ -2158,14 +2158,10 @@ void RTLightingFeatGLSL::processPix( Vector<ShaderComponent*> &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<ShaderComponent*> &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<ShaderComponent*> &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<ShaderConnector *>( componentList[C_CONNECTOR] );
@ -2978,6 +2974,8 @@ void ReflectionProbeFeatGLSL::processPix(Vector<ShaderComponent*>& 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

View file

@ -137,6 +137,7 @@ public:
MultiLine *meta );
Var* getSurface(Vector<ShaderComponent*>& componentList, MultiLine* meta, const MaterialFeatureData& fd);
Var* getInWorldNormal(Vector<ShaderComponent*>& componentList);
// ShaderFeature
Var* getVertTexCoord( const String &name );

View file

@ -879,12 +879,10 @@ Var* ShaderFeatureHLSL::getSurface(Vector<ShaderComponent*>& 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<ShaderComponent*>& 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<ShaderComponent*> &componentList,
const MaterialFeatureData &fd )
{
if (fd.features[MFT_ImposterVert]) return;
MultiLine *meta = new MultiLine;
ShaderConnector *connectComp = dynamic_cast<ShaderConnector *>( componentList[C_CONNECTOR] );
@ -2178,11 +2182,14 @@ void RTLightingFeatHLSL::processVert( Vector<ShaderComponent*> &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<ShaderComponent*> &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<ShaderComponent*> &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<ShaderComponent*> &componentList,
@ -2229,10 +2230,9 @@ void RTLightingFeatHLSL::processPix( Vector<ShaderComponent*> &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<ShaderComponent*> &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<ShaderConnector *>( componentList[C_CONNECTOR] );

View file

@ -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)

View file

@ -92,7 +92,7 @@ class ActionMap : public SimObject
U32 deviceInst;
Vector<Node> nodeMap;
DeviceMap():deviceType(NULL), deviceInst(NULL){
DeviceMap():deviceType(0), deviceInst(0){
VECTOR_SET_ASSOCIATION(nodeMap);
}
~DeviceMap();

Some files were not shown because too many files have changed in this diff Show more