mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-12 23:24:41 +00:00
New console type for Point3I
This commit is contained in:
parent
f43e878a26
commit
af7787b4bb
2 changed files with 36 additions and 0 deletions
|
|
@ -55,6 +55,15 @@ IMPLEMENT_STRUCT( Point2F,
|
||||||
FIELD( x, x, 1, "X coordinate." )
|
FIELD( x, x, 1, "X coordinate." )
|
||||||
FIELD( y, y, 1, "Y coordinate." )
|
FIELD( y, y, 1, "Y coordinate." )
|
||||||
|
|
||||||
|
END_IMPLEMENT_STRUCT;
|
||||||
|
IMPLEMENT_STRUCT( Point3I,
|
||||||
|
Point3I, MathTypes,
|
||||||
|
"" )
|
||||||
|
|
||||||
|
FIELD( x, x, 1, "X coordinate." )
|
||||||
|
FIELD( y, y, 1, "Y coordinate." )
|
||||||
|
FIELD( z, z, 1, "Z coordinate." )
|
||||||
|
|
||||||
END_IMPLEMENT_STRUCT;
|
END_IMPLEMENT_STRUCT;
|
||||||
IMPLEMENT_STRUCT( Point3F,
|
IMPLEMENT_STRUCT( Point3F,
|
||||||
Point3F, MathTypes,
|
Point3F, MathTypes,
|
||||||
|
|
@ -153,6 +162,30 @@ ConsoleSetType( TypePoint2F )
|
||||||
Con::printf("Point2F must be set as { x, y } or \"x y\"");
|
Con::printf("Point2F must be set as { x, y } or \"x y\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// TypePoint3I
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
ConsoleType( Point3I, TypePoint3I, Point3I )
|
||||||
|
ImplementConsoleTypeCasters(TypePoint3I, Point3I)
|
||||||
|
|
||||||
|
ConsoleGetType( TypePoint3I )
|
||||||
|
{
|
||||||
|
Point3I *pt = (Point3I *) dptr;
|
||||||
|
char* returnBuffer = Con::getReturnBuffer(256);
|
||||||
|
dSprintf(returnBuffer, 256, "%d %d %d", pt->x, pt->y, pt->z);
|
||||||
|
return returnBuffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
ConsoleSetType( TypePoint3I )
|
||||||
|
{
|
||||||
|
if(argc == 1)
|
||||||
|
dSscanf(argv[0], "%d %d %d", &((Point3I *) dptr)->x, &((Point3I *) dptr)->y, &((Point3I *) dptr)->z);
|
||||||
|
else if(argc == 3)
|
||||||
|
*((Point3I *) dptr) = Point3I(dAtoi(argv[0]), dAtoi(argv[1]), dAtoi(argv[2]));
|
||||||
|
else
|
||||||
|
Con::printf("Point3I must be set as { x, y, z } or \"x y z\"");
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// TypePoint3F
|
// TypePoint3F
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ void RegisterMathFunctions(void);
|
||||||
|
|
||||||
class Point2I;
|
class Point2I;
|
||||||
class Point2F;
|
class Point2F;
|
||||||
|
class Point3I;
|
||||||
class Point3F;
|
class Point3F;
|
||||||
class Point4F;
|
class Point4F;
|
||||||
class RectI;
|
class RectI;
|
||||||
|
|
@ -49,6 +50,7 @@ DECLARE_SCOPE( MathTypes );
|
||||||
|
|
||||||
DECLARE_STRUCT( Point2I );
|
DECLARE_STRUCT( Point2I );
|
||||||
DECLARE_STRUCT( Point2F );
|
DECLARE_STRUCT( Point2F );
|
||||||
|
DECLARE_STRUCT( Point3I );
|
||||||
DECLARE_STRUCT( Point3F );
|
DECLARE_STRUCT( Point3F );
|
||||||
DECLARE_STRUCT( Point4F );
|
DECLARE_STRUCT( Point4F );
|
||||||
DECLARE_STRUCT( RectI );
|
DECLARE_STRUCT( RectI );
|
||||||
|
|
@ -63,6 +65,7 @@ DECLARE_STRUCT( EaseF );
|
||||||
// Legacy console types.
|
// Legacy console types.
|
||||||
DefineConsoleType( TypePoint2I, Point2I )
|
DefineConsoleType( TypePoint2I, Point2I )
|
||||||
DefineConsoleType( TypePoint2F, Point2F )
|
DefineConsoleType( TypePoint2F, Point2F )
|
||||||
|
DefineConsoleType( TypePoint3I, Point3I )
|
||||||
DefineConsoleType( TypePoint3F, Point3F )
|
DefineConsoleType( TypePoint3F, Point3F )
|
||||||
DefineConsoleType( TypePoint4F, Point4F )
|
DefineConsoleType( TypePoint4F, Point4F )
|
||||||
DefineConsoleType( TypeRectI, RectI )
|
DefineConsoleType( TypeRectI, RectI )
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue