Skip to content

WIP: Added some missing field info to the EngineApi interface #2241

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

Closed
wants to merge 1 commit into from
Closed
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
3 changes: 3 additions & 0 deletions Engine/source/T3D/trigger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,9 @@ bool Trigger::castRay(const Point3F &start, const Point3F &end, RayInfo* info)
DECLARE_STRUCT( Polyhedron );
IMPLEMENT_STRUCT( Polyhedron, Polyhedron,,
"" )
FIELD(pointList, pointList, 1, "")
FIELD(planeList, planeList, 1, "")
FIELD(edgeList, edgeList, 1, "")
END_IMPLEMENT_STRUCT;
ConsoleType(floatList, TypeTriggerPolyhedron, Polyhedron, "")

Expand Down
2 changes: 2 additions & 0 deletions Engine/source/afx/arcaneFX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,8 @@ DefineEngineMethod(NetConnection, ResolveGhost, S32, (int ghostIndex),,

IMPLEMENT_STRUCT( ByteRange, ByteRange,,
"" )
FIELD(low, low, 1, "")
FIELD(high, high, 1, "")
END_IMPLEMENT_STRUCT;

ConsoleType( ByteRange, TypeByteRange, ByteRange, "")
Expand Down
16 changes: 16 additions & 0 deletions Engine/source/console/engineStructs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,40 @@
IMPLEMENT_STRUCT( Vector< bool >,
BoolVector,,
"" )
FIELD(mElementCount, elementCount, 1, "")
FIELD(mArraySize, arraySize, 1, "")
FIELD(mArray, elements, 1, "")
END_IMPLEMENT_STRUCT;


IMPLEMENT_STRUCT( Vector< S32 >,
IntVector,,
"" )
FIELD(mElementCount, elementCount, 1, "")
FIELD(mArraySize, arraySize, 1, "")
FIELD(mArray, elements, 1, "")
END_IMPLEMENT_STRUCT;


IMPLEMENT_STRUCT( Vector< F32 >,
FloatVector,,
"" )
FIELD(mElementCount, elementCount, 1, "")
FIELD(mArraySize, arraySize, 1, "")
FIELD(mArray, elements, 1, "")
END_IMPLEMENT_STRUCT;


IMPLEMENT_STRUCT( Torque::UUID,
UUID,,
"" )
FIELD(a, a, 1, "")
FIELD(b, b, 1, "")
FIELD(c, c, 1, "")
FIELD(d, d, 1, "")
FIELD(e, e, 1, "")
FIELD(f, f, 6, "")

END_IMPLEMENT_STRUCT;


Expand Down
3 changes: 2 additions & 1 deletion Engine/source/core/util/tVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,12 @@ extern bool VectorResize(U32 *aSize, U32 *aCount, void **arrayPtr, U32 newCount,
template<class T>
class Vector
{
protected:
public:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quite dangerous, completely breaks encapsulation...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I forgot I made that change in there, wanted to bring it up and ask if there were another way to do it.. Maybe moving the Implement Struct to somewhere associated with Vector?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An alternative solution is hard-coding the offsets:

IMPLEMENT_STRUCT( Vector< bool >,
   BoolVector,,
   "" )
   {"elementCount", "", 1, TYPE<U32>(), 0},
   {"arraySize", "", 1, TYPE<U32>(), 4},
   {"array", "", 1, TYPE<bool*>(), 8},
   //FIELD(mElementCount, elementCount, 1, "")
   //FIELD(mArraySize, arraySize, 1, "")
   //FIELD(mArray, elements, 1, "")
END_IMPLEMENT_STRUCT;

Copy link
Contributor Author

@lukaspj lukaspj Apr 8, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or the offsets could be computed and defined in tVector.h, but that sort of breaks encapsulation as well.

U32 mElementCount; ///< Number of elements currently in the Vector.
U32 mArraySize; ///< Number of elements allocated for the Vector.
T* mArray; ///< Pointer to the Vector elements.

protected:
#ifdef TORQUE_DEBUG_GUARD
const char* mFileAssociation;
U32 mLineAssociation;
Expand Down
4 changes: 2 additions & 2 deletions Engine/source/core/util/uuid.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ namespace Torque
public:

typedef void Parent;

protected:

U32 a;
U16 b;
U16 c;
U8 d;
U8 e;
U8 f[ 6 ];

protected:

static UUID smNull;

Expand Down
2 changes: 1 addition & 1 deletion Engine/source/math/mMatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

class MatrixF
{
private:
public:
F32 m[16]; ///< Note: Torque uses row-major matrices

public:
Expand Down
15 changes: 15 additions & 0 deletions Engine/source/math/mathTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,30 +88,45 @@ END_IMPLEMENT_STRUCT;
IMPLEMENT_STRUCT( RectI,
RectI, MathTypes,
"" )
FIELD(point, point, 1, "The XY coordinate of the Rect.")
FIELD(extent, extent, 1, "The width and height of the Rect.")
END_IMPLEMENT_STRUCT;
IMPLEMENT_STRUCT( RectF,
RectF, MathTypes,
"" )
FIELD(point, point, 1, "The XY coordinate of the Rect.")
FIELD(extent, extent, 1, "The width and height of the Rect.")
END_IMPLEMENT_STRUCT;
IMPLEMENT_STRUCT( MatrixF,
MatrixF, MathTypes,
"" )
FIELD(m, m, 16, "16 - element matrix (row-major)")
END_IMPLEMENT_STRUCT;
IMPLEMENT_STRUCT( AngAxisF,
AngAxisF, MathTypes,
"" )
FIELD(axis, axis, 1, "")
FIELD(angle, angle, 1, "")
END_IMPLEMENT_STRUCT;
IMPLEMENT_STRUCT( TransformF,
TransformF, MathTypes,
"" )
FIELD(mPosition, position, 1, "")
FIELD(mOrientation, orientation, 1, "")
FIELD(mHasRotation, hasRotation, 1, "")
END_IMPLEMENT_STRUCT;
IMPLEMENT_STRUCT( Box3F,
Box3F, MathTypes,
"" )
FIELD(minExtents, minExtents, 1, "Minimum extents of box")
FIELD(maxExtents, maxExtents, 1, "Maximum extents of box")
END_IMPLEMENT_STRUCT;
IMPLEMENT_STRUCT( EaseF,
EaseF, MathTypes,
"" )
FIELD(dir, dir, 1, "inout, in, out")
FIELD(type, type, 1, "linear, etc...")
FIELD(param, param, 2, "optional params")
END_IMPLEMENT_STRUCT;
IMPLEMENT_STRUCT(RotationF,
RotationF, MathTypes,
Expand Down