commit x64 compilation from lulu cause the other branch dont seems to compile properly at home
This commit is contained in:
217
include/modules/script_squirrel/legacy/object_binding.cpp
Normal file
217
include/modules/script_squirrel/legacy/object_binding.cpp
Normal file
@ -0,0 +1,217 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
GSFramework
|
||||
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
|
||||
----------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
#include "script_squirrel/legacy/binding_helpers.h"
|
||||
#include "scene3d/mobject.h"
|
||||
|
||||
using namespace GS::S3D;
|
||||
using namespace GS::Script;
|
||||
|
||||
|
||||
static CObjectType object_derived_types[] = { typetag_Item, typetag_Object, typetag_Undefined };
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
SQInteger ObjectGetLODBias(HSQUIRRELVM vm)
|
||||
{
|
||||
__SQ_RETURNFLOAT(GS::Core::Object::lod_bias)
|
||||
}
|
||||
SQInteger ObjectSetLODBias(HSQUIRRELVM vm)
|
||||
{
|
||||
__SQ_GETSINGLE(__SQ_GETFLOAT(bias))
|
||||
GS::Core::Object::lod_bias = bias;
|
||||
__SQ_RETURN
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------
|
||||
SQInteger ObjectGetItem(HSQUIRRELVM vm)
|
||||
//-----------------------------------------------
|
||||
{
|
||||
__SQ_GETSINGLESAFEPTR(obj, MObject, typetag_Object)
|
||||
__SQ_RETURNSAFEPTR((MItem *)obj, typetag_Item)
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
#define __SQ_ASSERTRENDERDATA(__I__) if (__I__->render_data.IsNull()) return sq_throwerror(vm, "No render data, have you setup this item render data?");
|
||||
|
||||
SQInteger ObjectSetGeometry(HSQUIRRELVM vm)
|
||||
{
|
||||
__SQ_GETSTART(2)
|
||||
__SQ_GETCOBJECTBASE(o, MObject, object_derived_types)
|
||||
__SQ_GETSAFEPTRALLOWNULL(geo, GS::Render::Geometry, typetag_Geometry)
|
||||
__SQ_GETEND
|
||||
__SQ_ASSERTRENDERDATA(o)
|
||||
o->geometry = geo ? geo->name : NULL;
|
||||
o->render_data->geometry = geo;
|
||||
__SQ_RETURN
|
||||
}
|
||||
SQInteger ObjectGetGeometry(HSQUIRRELVM vm)
|
||||
{
|
||||
__SQ_GETSINGLE(__SQ_GETCOBJECTBASE(o, MObject, object_derived_types))
|
||||
__SQ_ASSERTRENDERDATA(o)
|
||||
__SQ_RETURNSAFEPTR(o->render_data->geometry.c_ptr(), typetag_Geometry)
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
SQInteger ObjectSkinGetItemCount(HSQUIRRELVM vm)
|
||||
{
|
||||
__SQ_GETSINGLE(__SQ_GETCOBJECTBASE(o, MObject, object_derived_types))
|
||||
__SQ_RETURNINT(o->GetBoneCount())
|
||||
}
|
||||
SQInteger ObjectSkinGetItem(HSQUIRRELVM vm)
|
||||
{
|
||||
__SQ_GETSTART(2)
|
||||
__SQ_GETCOBJECTBASE(o, MObject, object_derived_types)
|
||||
__SQ_GETINT(n)
|
||||
__SQ_GETEND
|
||||
__SQ_RETURNSAFEPTR(o->GetBone(n) ? o->GetBone(n)->mitem : NULL, typetag_Item)
|
||||
}
|
||||
SQInteger ObjectSkinSetItem(HSQUIRRELVM vm)
|
||||
{
|
||||
__SQ_GETSTART(3)
|
||||
__SQ_GETCOBJECTBASE(o, MObject, object_derived_types)
|
||||
__SQ_GETINT(n)
|
||||
__SQ_GETSAFEPTRALLOWNULL(b, MItem, typetag_Item)
|
||||
__SQ_GETEND
|
||||
o->BindBone(n, b ? b->GetBaseItem() : NULL);
|
||||
__SQ_RETURN
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
SQInteger ObjectSetSkinMotion(HSQUIRRELVM vm)
|
||||
{
|
||||
/*
|
||||
__SQ_GETSTART(6)
|
||||
__SQ_GETSAFEPTR(obj, MObject, typetag_Object)
|
||||
__SQ_GETSTRING(motion_id)
|
||||
__SQ_GETFLOAT(blend)
|
||||
__SQ_GETFLOAT(weight)
|
||||
__SQ_GETFLOAT(t)
|
||||
__SQ_GETBOOL(loop)
|
||||
nHierarchyMotion *mot = (nHierarchyMotion *)obj->skin_motion_list.Find(motion_id);
|
||||
if (obj && mot)
|
||||
SetHierarchyMotion(obj->GetSkin(), mot, blend, weight, t, loop ? true : false);
|
||||
__SQ_GETEND
|
||||
__SQ_RETURN
|
||||
*/
|
||||
__SQ_GETSTART(2)
|
||||
__SQ_GETCOBJECTBASE(o, MObject, object_derived_types)
|
||||
__SQ_GETSTRING(motion_name)
|
||||
|
||||
// obj->SetSkinMotion(motion_name);
|
||||
|
||||
__SQ_GETEND
|
||||
__SQ_RETURN
|
||||
}
|
||||
SQInteger ObjectSetSkinMotionClockScale(HSQUIRRELVM vm)
|
||||
{
|
||||
__SQ_GETSTART(2)
|
||||
__SQ_GETCOBJECTBASE(o, MObject, object_derived_types)
|
||||
__SQ_GETFLOAT(scale)
|
||||
__SQ_GETEND
|
||||
return 0;
|
||||
}
|
||||
SQInteger ObjectStopAllSkinMotion(HSQUIRRELVM vm)
|
||||
{
|
||||
__SQ_GETSINGLE(__SQ_GETCOBJECTBASE(o, MObject, object_derived_types))
|
||||
// if (obj)
|
||||
// StopAllHierarchyMotion(obj->GetSkin());
|
||||
return 0;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void RegisterObjectBinding(HSQUIRRELVM vm)
|
||||
{
|
||||
/*#
|
||||
Topic: Object
|
||||
Type: Object
|
||||
Related: Item
|
||||
#*/
|
||||
|
||||
/*#
|
||||
Section: ObjectGeneric
|
||||
Desc: Generic functions
|
||||
#*/
|
||||
/*#
|
||||
Func: ObjectGetItem
|
||||
Proto: Item:Object
|
||||
Desc: Get object item.
|
||||
#*/
|
||||
sq_register(vm, ObjectGetItem, "ObjectGetItem", _SC(".x"));
|
||||
/*#
|
||||
Func: ObjectSetGeometry
|
||||
Proto: void:Object,Geometry
|
||||
Desc: Set object geometry.
|
||||
#*/
|
||||
sq_register(vm, ObjectSetGeometry, "ObjectSetGeometry", _SC(".xx"));
|
||||
/*#
|
||||
Func: ObjectGetGeometry
|
||||
Proto: Geometry:Object
|
||||
Desc: Get geometry object.
|
||||
#*/
|
||||
sq_register(vm, ObjectGetGeometry, "ObjectGetGeometry", _SC(".x"));
|
||||
/*#
|
||||
Func: ObjectGetLODBias
|
||||
Proto: float:
|
||||
Desc: Get global object geometry lod bias.
|
||||
Note: This value is added to the distance used to select the lod level for a geometry before displaying it.
|
||||
#*/
|
||||
sq_register(vm, ObjectGetLODBias, "ObjectGetLODBias", _SC("."));
|
||||
/*#
|
||||
Func: ObjectSetLODBias
|
||||
Proto: void:float bias
|
||||
Desc: Set global object geometry lod bias.
|
||||
Note: This value is added to the distance used to select the lod level for a geometry before displaying it.
|
||||
Example: ObjectSetLODBias(Mtr(10.0)) // Push all geometry LODs back by 10 meters.
|
||||
#*/
|
||||
sq_register(vm, ObjectSetLODBias, "ObjectSetLODBias", _SC(".n"));
|
||||
|
||||
/*#
|
||||
Section: ObjectSkin
|
||||
Desc: Skin functions
|
||||
#*/
|
||||
/*#
|
||||
Func: ObjectSkinGetItemCount
|
||||
Proto: int:Object
|
||||
Desc: Return the number of bone items in the object skin.
|
||||
#*/
|
||||
sq_register(vm, ObjectSkinGetItemCount, "ObjectSkinGetItemCount", _SC(".x"));
|
||||
/*#
|
||||
Func: ObjectSkinGetItem
|
||||
Proto: Item:Object,int index
|
||||
Desc: Return a bone item from the object skin.
|
||||
#*/
|
||||
sq_register(vm, ObjectSkinGetItem, "ObjectSkinGetItem", _SC(".xi"));
|
||||
/*#
|
||||
Func: ObjectSkinSetItem
|
||||
Proto: void:Object,int index,Item bone
|
||||
Desc: Set a bone item in the object skin.
|
||||
#*/
|
||||
sq_register(vm, ObjectSkinSetItem, "ObjectSkinSetItem", _SC(".xix"));
|
||||
|
||||
/*#
|
||||
Func: ObjectSetSkinMotion
|
||||
Proto: void:Object,string name
|
||||
Desc: Set object skin motion.
|
||||
#*/
|
||||
sq_register(vm, ObjectSetSkinMotion, "ObjectSetSkinMotion", _SC(".xs"));
|
||||
/*#
|
||||
Func: ObjectSetSkinMotionClockScale
|
||||
Proto: void:Object,float scale
|
||||
Desc: Set current object skin motion clock scale.
|
||||
#*/
|
||||
sq_register(vm, ObjectSetSkinMotionClockScale, "ObjectSetSkinMotionClockScale", _SC(".xf"));
|
||||
/*#
|
||||
Func: ObjectStopAllSkinMotion
|
||||
Proto: void:Object
|
||||
Desc: Stop all object skin motions.
|
||||
#*/
|
||||
sq_register(vm, ObjectStopAllSkinMotion, "ObjectStopAllSkinMotion", _SC(".x"));
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
Reference in New Issue
Block a user