Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OgreRootLayout uses json elements despite OGRE_NO_JSON. #443

Merged
merged 2 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 32 additions & 17 deletions OgreMain/src/OgreRootLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,27 @@ THE SOFTWARE.
#include "OgreGpuProgram.h"
#include "OgreLogManager.h"
#include "OgreLwString.h"
#include "OgreStringConverter.h"

#if defined( __GNUC__ ) && !defined( __clang__ )
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wclass-memaccess"
#endif
#if defined( __clang__ )
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wimplicit-int-float-conversion"
# pragma clang diagnostic ignored "-Wdeprecated-copy"
#endif
#include "rapidjson/document.h"
#include "rapidjson/error/en.h"
#if defined( __clang__ )
# pragma clang diagnostic pop
#endif
#if defined( __GNUC__ ) && !defined( __clang__ )
# pragma GCC diagnostic pop
#if !OGRE_NO_JSON
# include "OgreStringConverter.h"
#
# if defined( __GNUC__ ) && !defined( __clang__ )
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wclass-memaccess"
# endif
# if defined( __clang__ )
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wimplicit-int-float-conversion"
# pragma clang diagnostic ignored "-Wdeprecated-copy"
# endif
# include "rapidjson/document.h"
# include "rapidjson/error/en.h"
# if defined( __clang__ )
# pragma clang diagnostic pop
# endif
# if defined( __GNUC__ ) && !defined( __clang__ )
# pragma GCC diagnostic pop
# endif
#endif

#define TODO_limit_NUM_BIND_TEXTURES // and co.
Expand Down Expand Up @@ -358,6 +361,7 @@ namespace Ogre
void RootLayout::parseSet( const rapidjson::Value &jsonValue, const size_t setIdx,
const String &filename )
{
#if !OGRE_NO_JSON
rapidjson::Value::ConstMemberIterator itor;

itor = jsonValue.FindMember( "baked" );
Expand Down Expand Up @@ -450,6 +454,11 @@ namespace Ogre
}
}
}
#else
OGRE_EXCEPT( Exception::ERR_INVALID_CALL,
"Ogre must be built with JSON support to call this function!",
"RootLayout::parseSet" );
#endif
}
//-------------------------------------------------------------------------
void RootLayout::addArrayBinding( DescBindingTypes::DescBindingTypes bindingType,
Expand Down Expand Up @@ -543,6 +552,7 @@ namespace Ogre
void RootLayout::parseRootLayout( const char *rootLayout, const bool bCompute,
const String &filename )
{
#if !OGRE_NO_JSON
mCompute = bCompute;
mParamsBuffStages = 0u;

Expand Down Expand Up @@ -623,6 +633,11 @@ namespace Ogre
LogManager::getSingleton().logMessage( dumpStr, LML_CRITICAL );
throw;
}
#else
OGRE_EXCEPT( Exception::ERR_INVALID_CALL,
"Ogre must be built with JSON support to call this function!",
"RootLayout::parseRootLayout" );
#endif
}
//-----------------------------------------------------------------------------------
inline void RootLayout::flushLwString( LwString &jsonStr, String &outJson )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@
#define toFloat3x3( x ) mat3( x )
#define buildFloat3x3( row0, row1, row2 ) mat3( row0, row1, row2 )

#define buildFloat4x4( row0, row1, row2, row3 ) mat4( row0, row1, row2, row3 )

// Let's explain this madness:
//
// We use the keyword "midf" because "half" is already taken on Metal.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ precision highp sampler2DArray;
#define toFloat3x3( x ) mat3( x )
#define buildFloat3x3( row0, row1, row2 ) mat3( row0, row1, row2 )

#define buildFloat4x4( row0, row1, row2, row3 ) mat4( row0, row1, row2, row3 )

#define mul( x, y ) ((x) * (y))
#define saturate(x) clamp( (x), 0.0, 1.0 )
#define lerp mix
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#define toFloat3x3( x ) ((float3x3)(x))
#define buildFloat3x3( row0, row1, row2 ) transpose( float3x3( row0, row1, row2 ) )

#define buildFloat4x4( row0, row1, row2, row3 ) transpose( float4x4( row0, row1, row2, row3 ) )

// See CrossPlatformSettings_piece_all.glsl for an explanation
@property( precision_mode == full32 )
#define _h(x) (x)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ inline half3x3 toMatHalf3x3( float3x4 m )
#define toFloat3x3( x ) toMat3x3( x )
#define buildFloat3x3( row0, row1, row2 ) float3x3( float3( row0 ), float3( row1 ), float3( row2 ) )

#define buildFloat4x4( row0, row1, row2, row3 ) float4x4( float4( row0 ), float4( row1 ), float4( row2 ), float4( row3 ) )

// See CrossPlatformSettings_piece_all.glsl for an explanation
@property( precision_mode == full32 )
// In Metal 'half' is an actual datatype. It should be OK to override it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,7 @@
@foreach( 4, n )
float4 row@n = readOnlyFetch( worldMatBuf, int( poseDataStart + @value(NumPoseWeightVectors)u + 4u + @nu ) );
@end
float4x4 worldView = float4x4( row0, row1, row2, row3 );
@property( syntax == hlsl )
worldView = transpose( worldView );
@end
float4x4 worldView = buildFloat4x4( row0, row1, row2, row3 );
@end
@end
@end // PoseTransform
Expand Down
Loading