1
0

Moved cTracer::SetValues to be an internal function because it is only ever used in cTracer::Trace.

Removed SetValues from Bindings.cpp.
Added some commenting to explain what each function does in cTracer.
This commit is contained in:
Samuel Barney 2013-11-05 09:22:28 -07:00
parent b23047f47b
commit e37531fe01
2 changed files with 16 additions and 37 deletions

View File

@ -23790,41 +23790,6 @@ static int tolua_AllToLua_cTracer_Trace00(lua_State* tolua_S)
}
#endif //#ifndef TOLUA_DISABLE
/* method: SetValues of class cTracer */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cTracer_SetValues00
static int tolua_AllToLua_cTracer_SetValues00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"cTracer",0,&tolua_err) ||
(tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3f",0,&tolua_err)) ||
(tolua_isvaluenil(tolua_S,3,&tolua_err) || !tolua_isusertype(tolua_S,3,"const Vector3f",0,&tolua_err)) ||
!tolua_isnoobj(tolua_S,4,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
cTracer* self = (cTracer*) tolua_tousertype(tolua_S,1,0);
const Vector3f* a_Start = ((const Vector3f*) tolua_tousertype(tolua_S,2,0));
const Vector3f* a_Direction = ((const Vector3f*) tolua_tousertype(tolua_S,3,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetValues'", NULL);
#endif
{
self->SetValues(*a_Start,*a_Direction);
}
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'SetValues'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* get function: BlockHitPosition of class cTracer */
#ifndef TOLUA_DISABLE_tolua_get_cTracer_BlockHitPosition
static int tolua_get_cTracer_BlockHitPosition(lua_State* tolua_S)
@ -30959,7 +30924,6 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_function(tolua_S,".call",tolua_AllToLua_cTracer_new00_local);
tolua_function(tolua_S,"delete",tolua_AllToLua_cTracer_delete00);
tolua_function(tolua_S,"Trace",tolua_AllToLua_cTracer_Trace00);
tolua_function(tolua_S,"SetValues",tolua_AllToLua_cTracer_SetValues00);
tolua_variable(tolua_S,"BlockHitPosition",tolua_get_cTracer_BlockHitPosition,tolua_set_cTracer_BlockHitPosition);
tolua_variable(tolua_S,"HitNormal",tolua_get_cTracer_HitNormal,tolua_set_cTracer_HitNormal);
tolua_variable(tolua_S,"RealHit",tolua_get_cTracer_RealHit,tolua_set_cTracer_RealHit);

View File

@ -12,14 +12,29 @@ public: // tolua_export
Vector3f BoxOffset;
cTracer( cWorld* a_World); // tolua_export
~cTracer(); // tolua_export
/// Determines if a collision occures along a line.
int Trace( const Vector3f & a_Start, const Vector3f & a_Direction, int a_Distance ); // tolua_export
void SetValues( const Vector3f & a_Start, const Vector3f & a_Direction ); // tolua_export
/// Contains the position of the block that caused the collision
Vector3f BlockHitPosition; // tolua_export
/// Contains which face was hit
Vector3f HitNormal; // tolua_export
/// Contains the exact position where a collision occured. (BlockHitPosition + Offset on block)
Vector3f RealHit; // tolua_export
private:
/// Preps Tracer object for call of Trace function. Only used internally
void SetValues( const Vector3f & a_Start, const Vector3f & a_Direction );
/// Calculates where on the block a collision occured, if it does occur
int intersect3D_SegmentPlane( const Vector3f & a_Origin, const Vector3f & a_End, const Vector3f & a_PlanePos, const Vector3f & a_PlaneNormal );
/// Determines which face on the block a collision occured, if it does occur
int GetHitNormal( const Vector3f & start, const Vector3f & end, const Vector3i & a_BlockPos);
float SigNum( float a_Num );
cWorld* m_World;