diff --git a/rcbasic_build/embedded_functions.bas b/rcbasic_build/embedded_functions.bas index 7d5fc31..eda803e 100644 --- a/rcbasic_build/embedded_functions.bas +++ b/rcbasic_build/embedded_functions.bas @@ -44,4 +44,5 @@ Include "/home/n00b/Projects/RCBASIC4/rcbasic_build/intern_lib/lights.bas" Include "/home/n00b/Projects/RCBASIC4/rcbasic_build/intern_lib/terrain.bas" Include "/home/n00b/Projects/RCBASIC4/rcbasic_build/intern_lib/water.bas" Include "/home/n00b/Projects/RCBASIC4/rcbasic_build/intern_lib/projector.bas" +Include "/home/n00b/Projects/RCBASIC4/rcbasic_build/intern_lib/composite.bas" Include "/home/n00b/Projects/RCBASIC4/rcbasic_build/intern_lib/materials.bas" diff --git a/rcbasic_build/intern_inc/switch_cases.h b/rcbasic_build/intern_inc/switch_cases.h index 167c81e..176dd44 100644 --- a/rcbasic_build/intern_inc/switch_cases.h +++ b/rcbasic_build/intern_inc/switch_cases.h @@ -1048,6 +1048,18 @@ rc_setProjectorTarget( SETPROJECTORTARGET_ACTOR, SETPROJECTORTARGET_X, SETPROJ rc_getProjectorTarget( GETPROJECTORTARGET_ACTOR, &GETPROJECTORTARGET_X, &GETPROJECTORTARGET_Y, &GETPROJECTORTARGET_Z ) rc_setProjectorFOV( SETPROJECTORFOV_ACTOR, SETPROJECTORFOV_FOV ) rc_getProjectorFOV( GETPROJECTORFOV_ACTOR ) +rc_addCompositeChild( ADDCOMPOSITECHILD_ACTOR, ADDCOMPOSITECHILD_CHILD_ACTOR, ADDCOMPOSITECHILD_T_MATRIX ) +rc_getCompositeChildCount( GETCOMPOSITECHILDCOUNT_ACTOR ) +rc_getCompositeChild( GETCOMPOSITECHILD_ACTOR, GETCOMPOSITECHILD_CHILD_INDEX ) +rc_getCompositeChildIndex( GETCOMPOSITECHILDINDEX_ACTOR, GETCOMPOSITECHILDINDEX_CHILD_ACTOR ) +rc_removeCompositeChild( REMOVECOMPOSITECHILD_ACTOR, REMOVECOMPOSITECHILD_CHILD_INDEX ) +rc_getCompositeChildTransform( GETCOMPOSITECHILDTRANSFORM_ACTOR, GETCOMPOSITECHILDTRANSFORM_CHILD_INDEX, GETCOMPOSITECHILDTRANSFORM_T_MATRIX ) +rc_getCompositeAABB( GETCOMPOSITEAABB_ACTOR, GETCOMPOSITEAABB_T_MATRIX, &GETCOMPOSITEAABB_MIN_X, &GETCOMPOSITEAABB_MIN_Y, &GETCOMPOSITEAABB_MIN_Z, &GETCOMPOSITEAABB_MAX_X, &GETCOMPOSITEAABB_MAX_Y, &GETCOMPOSITEAABB_MAX_Z ) +rc_recalculateCompositeAABB( RECALCULATECOMPOSITEAABB_ACTOR ) +rc_generateCompositeAABBFromChildren( GENERATECOMPOSITEAABBFROMCHILDREN_ACTOR ) +rc_calculateCompositePrincipalTransform( CALCULATECOMPOSITEPRINCIPALTRANSFORM_ACTOR, &CALCULATECOMPOSITEPRINCIPALTRANSFORM_MASSES, CALCULATECOMPOSITEPRINCIPALTRANSFORM_PRINCIPAL_MATRIX, &CALCULATECOMPOSITEPRINCIPALTRANSFORM_X, &CALCULATECOMPOSITEPRINCIPALTRANSFORM_Y, &CALCULATECOMPOSITEPRINCIPALTRANSFORM_Z ) +rc_updateCompositeChildTransform( UPDATECOMPOSITECHILDTRANSFORM_ACTOR, UPDATECOMPOSITECHILDTRANSFORM_CHILD_INDEX, UPDATECOMPOSITECHILDTRANSFORM_T_MATRIX, UPDATECOMPOSITECHILDTRANSFORM_RECALC_FLAG ) +rc_getCompositeUpdateRevision( GETCOMPOSITEUPDATEREVISION_ACTOR ) rc_createMaterial( ) rc_deleteMaterial( DELETEMATERIAL_MATERIAL_ID ) rc_setActorMaterial( SETACTORMATERIAL_ACTOR, SETACTORMATERIAL_MATERIAL_NUM, SETACTORMATERIAL_MATERIAL_ID ) diff --git a/rcbasic_build/intern_lib/composite.bas b/rcbasic_build/intern_lib/composite.bas new file mode 100644 index 0000000..908e4fe --- /dev/null +++ b/rcbasic_build/intern_lib/composite.bas @@ -0,0 +1,12 @@ +Function AddCompositeChild(actor, child_actor, t_matrix) +Function GetCompositeChildCount(actor) +Function GetCompositeChild(actor, child_index) +Function GetCompositeChildIndex(actor, child_actor) +Sub RemoveCompositeChild(actor, child_index) +Function GetCompositeChildTransform(actor, child_index, t_matrix) +Function GetCompositeAABB(actor, t_matrix, ByRef min_x, ByRef min_y, ByRef min_z, ByRef max_x, ByRef max_y, ByRef max_z) +Sub RecalculateCompositeAABB(actor) +Sub GenerateCompositeAABBFromChildren(actor) +Sub CalculateCompositePrincipalTransform(actor, ByRef masses, principal_matrix, ByRef x, ByRef y, ByRef z) +Sub UpdateCompositeChildTransform(actor, child_index, t_matrix, recalc_flag) +Function GetCompositeUpdateRevision(actor) diff --git a/rcbasic_build/rc_builtin.h b/rcbasic_build/rc_builtin.h index 0327a80..191c954 100755 --- a/rcbasic_build/rc_builtin.h +++ b/rcbasic_build/rc_builtin.h @@ -3314,6 +3314,52 @@ void init_embedded_functions() add_embedded_arg("fov", ID_TYPE_NUM); embed_function("GetProjectorFOV", ID_TYPE_FN_NUM); add_embedded_arg("actor", ID_TYPE_NUM); + embed_function("AddCompositeChild", ID_TYPE_FN_NUM); + add_embedded_arg("actor", ID_TYPE_NUM); + add_embedded_arg("child_actor", ID_TYPE_NUM); + add_embedded_arg("t_matrix", ID_TYPE_NUM); + embed_function("GetCompositeChildCount", ID_TYPE_FN_NUM); + add_embedded_arg("actor", ID_TYPE_NUM); + embed_function("GetCompositeChild", ID_TYPE_FN_NUM); + add_embedded_arg("actor", ID_TYPE_NUM); + add_embedded_arg("child_index", ID_TYPE_NUM); + embed_function("GetCompositeChildIndex", ID_TYPE_FN_NUM); + add_embedded_arg("actor", ID_TYPE_NUM); + add_embedded_arg("child_actor", ID_TYPE_NUM); + embed_function("RemoveCompositeChild", ID_TYPE_SUB); + add_embedded_arg("actor", ID_TYPE_NUM); + add_embedded_arg("child_index", ID_TYPE_NUM); + embed_function("GetCompositeChildTransform", ID_TYPE_FN_NUM); + add_embedded_arg("actor", ID_TYPE_NUM); + add_embedded_arg("child_index", ID_TYPE_NUM); + add_embedded_arg("t_matrix", ID_TYPE_NUM); + embed_function("GetCompositeAABB", ID_TYPE_FN_NUM); + add_embedded_arg("actor", ID_TYPE_NUM); + add_embedded_arg("t_matrix", ID_TYPE_NUM); + add_embedded_arg("min_x", ID_TYPE_BYREF_NUM); + add_embedded_arg("min_y", ID_TYPE_BYREF_NUM); + add_embedded_arg("min_z", ID_TYPE_BYREF_NUM); + add_embedded_arg("max_x", ID_TYPE_BYREF_NUM); + add_embedded_arg("max_y", ID_TYPE_BYREF_NUM); + add_embedded_arg("max_z", ID_TYPE_BYREF_NUM); + embed_function("RecalculateCompositeAABB", ID_TYPE_SUB); + add_embedded_arg("actor", ID_TYPE_NUM); + embed_function("GenerateCompositeAABBFromChildren", ID_TYPE_SUB); + add_embedded_arg("actor", ID_TYPE_NUM); + embed_function("CalculateCompositePrincipalTransform", ID_TYPE_SUB); + add_embedded_arg("actor", ID_TYPE_NUM); + add_embedded_arg("masses", ID_TYPE_BYREF_NUM); + add_embedded_arg("principal_matrix", ID_TYPE_NUM); + add_embedded_arg("x", ID_TYPE_BYREF_NUM); + add_embedded_arg("y", ID_TYPE_BYREF_NUM); + add_embedded_arg("z", ID_TYPE_BYREF_NUM); + embed_function("UpdateCompositeChildTransform", ID_TYPE_SUB); + add_embedded_arg("actor", ID_TYPE_NUM); + add_embedded_arg("child_index", ID_TYPE_NUM); + add_embedded_arg("t_matrix", ID_TYPE_NUM); + add_embedded_arg("recalc_flag", ID_TYPE_NUM); + embed_function("GetCompositeUpdateRevision", ID_TYPE_FN_NUM); + add_embedded_arg("actor", ID_TYPE_NUM); embed_function("createMaterial", ID_TYPE_FN_NUM); embed_function("deleteMaterial", ID_TYPE_SUB); add_embedded_arg("material_id", ID_TYPE_NUM); diff --git a/rcbasic_build/rcbasic4_changes.ods b/rcbasic_build/rcbasic4_changes.ods index 4aa12ab..c1fe092 100644 Binary files a/rcbasic_build/rcbasic4_changes.ods and b/rcbasic_build/rcbasic4_changes.ods differ diff --git a/rcbasic_build/rcbasic_dev.txt b/rcbasic_build/rcbasic_dev.txt index 64420a7..6a157b6 100644 --- a/rcbasic_build/rcbasic_dev.txt +++ b/rcbasic_build/rcbasic_dev.txt @@ -3308,6 +3308,52 @@ add_embedded_arg("actor", ID_TYPE_NUM); add_embedded_arg("fov", ID_TYPE_NUM); embed_function("GetProjectorFOV", ID_TYPE_FN_NUM); add_embedded_arg("actor", ID_TYPE_NUM); +embed_function("AddCompositeChild", ID_TYPE_FN_NUM); +add_embedded_arg("actor", ID_TYPE_NUM); +add_embedded_arg("child_actor", ID_TYPE_NUM); +add_embedded_arg("t_matrix", ID_TYPE_NUM); +embed_function("GetCompositeChildCount", ID_TYPE_FN_NUM); +add_embedded_arg("actor", ID_TYPE_NUM); +embed_function("GetCompositeChild", ID_TYPE_FN_NUM); +add_embedded_arg("actor", ID_TYPE_NUM); +add_embedded_arg("child_index", ID_TYPE_NUM); +embed_function("GetCompositeChildIndex", ID_TYPE_FN_NUM); +add_embedded_arg("actor", ID_TYPE_NUM); +add_embedded_arg("child_actor", ID_TYPE_NUM); +embed_function("RemoveCompositeChild", ID_TYPE_SUB); +add_embedded_arg("actor", ID_TYPE_NUM); +add_embedded_arg("child_index", ID_TYPE_NUM); +embed_function("GetCompositeChildTransform", ID_TYPE_FN_NUM); +add_embedded_arg("actor", ID_TYPE_NUM); +add_embedded_arg("child_index", ID_TYPE_NUM); +add_embedded_arg("t_matrix", ID_TYPE_NUM); +embed_function("GetCompositeAABB", ID_TYPE_FN_NUM); +add_embedded_arg("actor", ID_TYPE_NUM); +add_embedded_arg("t_matrix", ID_TYPE_NUM); +add_embedded_arg("min_x", ID_TYPE_BYREF_NUM); +add_embedded_arg("min_y", ID_TYPE_BYREF_NUM); +add_embedded_arg("min_z", ID_TYPE_BYREF_NUM); +add_embedded_arg("max_x", ID_TYPE_BYREF_NUM); +add_embedded_arg("max_y", ID_TYPE_BYREF_NUM); +add_embedded_arg("max_z", ID_TYPE_BYREF_NUM); +embed_function("RecalculateCompositeAABB", ID_TYPE_SUB); +add_embedded_arg("actor", ID_TYPE_NUM); +embed_function("GenerateCompositeAABBFromChildren", ID_TYPE_SUB); +add_embedded_arg("actor", ID_TYPE_NUM); +embed_function("CalculateCompositePrincipalTransform", ID_TYPE_SUB); +add_embedded_arg("actor", ID_TYPE_NUM); +add_embedded_arg("masses", ID_TYPE_BYREF_NUM); +add_embedded_arg("principal_matrix", ID_TYPE_NUM); +add_embedded_arg("x", ID_TYPE_BYREF_NUM); +add_embedded_arg("y", ID_TYPE_BYREF_NUM); +add_embedded_arg("z", ID_TYPE_BYREF_NUM); +embed_function("UpdateCompositeChildTransform", ID_TYPE_SUB); +add_embedded_arg("actor", ID_TYPE_NUM); +add_embedded_arg("child_index", ID_TYPE_NUM); +add_embedded_arg("t_matrix", ID_TYPE_NUM); +add_embedded_arg("recalc_flag", ID_TYPE_NUM); +embed_function("GetCompositeUpdateRevision", ID_TYPE_FN_NUM); +add_embedded_arg("actor", ID_TYPE_NUM); embed_function("createMaterial", ID_TYPE_FN_NUM); embed_function("deleteMaterial", ID_TYPE_SUB); add_embedded_arg("material_id", ID_TYPE_NUM); diff --git a/rcbasic_build/rcbasic_dev2.txt b/rcbasic_build/rcbasic_dev2.txt index 97c0ac7..399cbfd 100644 --- a/rcbasic_build/rcbasic_dev2.txt +++ b/rcbasic_build/rcbasic_dev2.txt @@ -3308,175 +3308,221 @@ #define SETPROJECTORFOV_FOV num_var[1].nref[0].value[ num_var[1].byref_offset ] #define FN_GetProjectorFOV 1049 #define GETPROJECTORFOV_ACTOR num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_createMaterial 1050 -#define FN_deleteMaterial 1051 +#define FN_AddCompositeChild 1050 +#define ADDCOMPOSITECHILD_ACTOR num_var[0].nref[0].value[ num_var[0].byref_offset ] +#define ADDCOMPOSITECHILD_CHILD_ACTOR num_var[1].nref[0].value[ num_var[1].byref_offset ] +#define ADDCOMPOSITECHILD_T_MATRIX num_var[2].nref[0].value[ num_var[2].byref_offset ] +#define FN_GetCompositeChildCount 1051 +#define GETCOMPOSITECHILDCOUNT_ACTOR num_var[0].nref[0].value[ num_var[0].byref_offset ] +#define FN_GetCompositeChild 1052 +#define GETCOMPOSITECHILD_ACTOR num_var[0].nref[0].value[ num_var[0].byref_offset ] +#define GETCOMPOSITECHILD_CHILD_INDEX num_var[1].nref[0].value[ num_var[1].byref_offset ] +#define FN_GetCompositeChildIndex 1053 +#define GETCOMPOSITECHILDINDEX_ACTOR num_var[0].nref[0].value[ num_var[0].byref_offset ] +#define GETCOMPOSITECHILDINDEX_CHILD_ACTOR num_var[1].nref[0].value[ num_var[1].byref_offset ] +#define FN_RemoveCompositeChild 1054 +#define REMOVECOMPOSITECHILD_ACTOR num_var[0].nref[0].value[ num_var[0].byref_offset ] +#define REMOVECOMPOSITECHILD_CHILD_INDEX num_var[1].nref[0].value[ num_var[1].byref_offset ] +#define FN_GetCompositeChildTransform 1055 +#define GETCOMPOSITECHILDTRANSFORM_ACTOR num_var[0].nref[0].value[ num_var[0].byref_offset ] +#define GETCOMPOSITECHILDTRANSFORM_CHILD_INDEX num_var[1].nref[0].value[ num_var[1].byref_offset ] +#define GETCOMPOSITECHILDTRANSFORM_T_MATRIX num_var[2].nref[0].value[ num_var[2].byref_offset ] +#define FN_GetCompositeAABB 1056 +#define GETCOMPOSITEAABB_ACTOR num_var[0].nref[0].value[ num_var[0].byref_offset ] +#define GETCOMPOSITEAABB_T_MATRIX num_var[1].nref[0].value[ num_var[1].byref_offset ] +#define GETCOMPOSITEAABB_MIN_X num_var[2].nref[0].value[ num_var[2].byref_offset ] +#define GETCOMPOSITEAABB_MIN_Y num_var[3].nref[0].value[ num_var[3].byref_offset ] +#define GETCOMPOSITEAABB_MIN_Z num_var[4].nref[0].value[ num_var[4].byref_offset ] +#define GETCOMPOSITEAABB_MAX_X num_var[5].nref[0].value[ num_var[5].byref_offset ] +#define GETCOMPOSITEAABB_MAX_Y num_var[6].nref[0].value[ num_var[6].byref_offset ] +#define GETCOMPOSITEAABB_MAX_Z num_var[7].nref[0].value[ num_var[7].byref_offset ] +#define FN_RecalculateCompositeAABB 1057 +#define RECALCULATECOMPOSITEAABB_ACTOR num_var[0].nref[0].value[ num_var[0].byref_offset ] +#define FN_GenerateCompositeAABBFromChildren 1058 +#define GENERATECOMPOSITEAABBFROMCHILDREN_ACTOR num_var[0].nref[0].value[ num_var[0].byref_offset ] +#define FN_CalculateCompositePrincipalTransform 1059 +#define CALCULATECOMPOSITEPRINCIPALTRANSFORM_ACTOR num_var[0].nref[0].value[ num_var[0].byref_offset ] +#define CALCULATECOMPOSITEPRINCIPALTRANSFORM_MASSES num_var[1].nref[0].value[ num_var[1].byref_offset ] +#define CALCULATECOMPOSITEPRINCIPALTRANSFORM_PRINCIPAL_MATRIX num_var[2].nref[0].value[ num_var[2].byref_offset ] +#define CALCULATECOMPOSITEPRINCIPALTRANSFORM_X num_var[3].nref[0].value[ num_var[3].byref_offset ] +#define CALCULATECOMPOSITEPRINCIPALTRANSFORM_Y num_var[4].nref[0].value[ num_var[4].byref_offset ] +#define CALCULATECOMPOSITEPRINCIPALTRANSFORM_Z num_var[5].nref[0].value[ num_var[5].byref_offset ] +#define FN_UpdateCompositeChildTransform 1060 +#define UPDATECOMPOSITECHILDTRANSFORM_ACTOR num_var[0].nref[0].value[ num_var[0].byref_offset ] +#define UPDATECOMPOSITECHILDTRANSFORM_CHILD_INDEX num_var[1].nref[0].value[ num_var[1].byref_offset ] +#define UPDATECOMPOSITECHILDTRANSFORM_T_MATRIX num_var[2].nref[0].value[ num_var[2].byref_offset ] +#define UPDATECOMPOSITECHILDTRANSFORM_RECALC_FLAG num_var[3].nref[0].value[ num_var[3].byref_offset ] +#define FN_GetCompositeUpdateRevision 1061 +#define GETCOMPOSITEUPDATEREVISION_ACTOR num_var[0].nref[0].value[ num_var[0].byref_offset ] +#define FN_createMaterial 1062 +#define FN_deleteMaterial 1063 #define DELETEMATERIAL_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_setActorMaterial 1052 +#define FN_setActorMaterial 1064 #define SETACTORMATERIAL_ACTOR num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETACTORMATERIAL_MATERIAL_NUM num_var[1].nref[0].value[ num_var[1].byref_offset ] #define SETACTORMATERIAL_MATERIAL_ID num_var[2].nref[0].value[ num_var[2].byref_offset ] -#define FN_getActorMaterial 1053 +#define FN_getActorMaterial 1065 #define GETACTORMATERIAL_ACTOR num_var[0].nref[0].value[ num_var[0].byref_offset ] #define GETACTORMATERIAL_MATERIAL_NUM num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_copyActorMaterial 1054 +#define FN_copyActorMaterial 1066 #define COPYACTORMATERIAL_ACTOR num_var[0].nref[0].value[ num_var[0].byref_offset ] #define COPYACTORMATERIAL_MATERIAL_NUM num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_copyMaterial 1055 +#define FN_copyMaterial 1067 #define COPYMATERIAL_SMATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_setMaterialTextureCanvas 1056 +#define FN_setMaterialTextureCanvas 1068 #define SETMATERIALTEXTURECANVAS_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETMATERIALTEXTURECANVAS_LEVEL num_var[1].nref[0].value[ num_var[1].byref_offset ] #define SETMATERIALTEXTURECANVAS_CANVAS_ID num_var[2].nref[0].value[ num_var[2].byref_offset ] -#define FN_setMaterialAmbientColor 1057 +#define FN_setMaterialAmbientColor 1069 #define SETMATERIALAMBIENTCOLOR_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETMATERIALAMBIENTCOLOR_COLOR num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_getMaterialAmbientColor 1058 +#define FN_getMaterialAmbientColor 1070 #define GETMATERIALAMBIENTCOLOR_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_setMaterialAntiAliasing 1059 +#define FN_setMaterialAntiAliasing 1071 #define SETMATERIALANTIALIASING_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETMATERIALANTIALIASING_AA num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_getMaterialAntiAliasing 1060 +#define FN_getMaterialAntiAliasing 1072 #define GETMATERIALANTIALIASING_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_setMaterialBackfaceCulling 1061 +#define FN_setMaterialBackfaceCulling 1073 #define SETMATERIALBACKFACECULLING_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETMATERIALBACKFACECULLING_FLAG num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_getMaterialBackfaceCulling 1062 +#define FN_getMaterialBackfaceCulling 1074 #define GETMATERIALBACKFACECULLING_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_setMaterialBlendFactor 1063 +#define FN_setMaterialBlendFactor 1075 #define SETMATERIALBLENDFACTOR_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETMATERIALBLENDFACTOR_BF num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_getMaterialBlendFactor 1064 +#define FN_getMaterialBlendFactor 1076 #define GETMATERIALBLENDFACTOR_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_setMaterialBlendMode 1065 +#define FN_setMaterialBlendMode 1077 #define SETMATERIALBLENDMODE_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETMATERIALBLENDMODE_BLEND_MODE num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_getMaterialBlendMode 1066 +#define FN_getMaterialBlendMode 1078 #define GETMATERIALBLENDMODE_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_setMaterialColorMask 1067 +#define FN_setMaterialColorMask 1079 #define SETMATERIALCOLORMASK_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETMATERIALCOLORMASK_COLOR_MASK num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_getMaterialColorMask 1068 +#define FN_getMaterialColorMask 1080 #define GETMATERIALCOLORMASK_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_setMaterialColorMode 1069 +#define FN_setMaterialColorMode 1081 #define SETMATERIALCOLORMODE_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETMATERIALCOLORMODE_COLOR_MODE num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_getMaterialColorMode 1070 +#define FN_getMaterialColorMode 1082 #define GETMATERIALCOLORMODE_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_setMaterialDiffuseColor 1071 +#define FN_setMaterialDiffuseColor 1083 #define SETMATERIALDIFFUSECOLOR_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETMATERIALDIFFUSECOLOR_COLOR num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_getMaterialDiffuseColor 1072 +#define FN_getMaterialDiffuseColor 1084 #define GETMATERIALDIFFUSECOLOR_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_setMaterialEmissiveColor 1073 +#define FN_setMaterialEmissiveColor 1085 #define SETMATERIALEMISSIVECOLOR_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETMATERIALEMISSIVECOLOR_COLOR num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_getMaterialEmissiveColor 1074 +#define FN_getMaterialEmissiveColor 1086 #define GETMATERIALEMISSIVECOLOR_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_setMaterialFog 1075 +#define FN_setMaterialFog 1087 #define SETMATERIALFOG_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETMATERIALFOG_FLAG num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_getMaterialFog 1076 +#define FN_getMaterialFog 1088 #define GETMATERIALFOG_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_setMaterialFrontfaceCulling 1077 +#define FN_setMaterialFrontfaceCulling 1089 #define SETMATERIALFRONTFACECULLING_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETMATERIALFRONTFACECULLING_FLAG num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_getMaterialFrontfaceCulling 1078 +#define FN_getMaterialFrontfaceCulling 1090 #define GETMATERIALFRONTFACECULLING_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_setMaterialGouraudShading 1079 +#define FN_setMaterialGouraudShading 1091 #define SETMATERIALGOURAUDSHADING_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETMATERIALGOURAUDSHADING_FLAG num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_materialIsGouraudShaded 1080 +#define FN_materialIsGouraudShaded 1092 #define MATERIALISGOURAUDSHADED_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_materialIsAplhaBlend 1081 +#define FN_materialIsAplhaBlend 1093 #define MATERIALISAPLHABLEND_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_materialIsTransparent 1082 +#define FN_materialIsTransparent 1094 #define MATERIALISTRANSPARENT_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_setMaterialLighting 1083 +#define FN_setMaterialLighting 1095 #define SETMATERIALLIGHTING_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETMATERIALLIGHTING_FLAG num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_materialIsLit 1084 +#define FN_materialIsLit 1096 #define MATERIALISLIT_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_setMaterialType 1085 +#define FN_setMaterialType 1097 #define SETMATERIALTYPE_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETMATERIALTYPE_MAT_TYPE num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_getMaterialType 1086 +#define FN_getMaterialType 1098 #define GETMATERIALTYPE_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_setMaterialNormalize 1087 +#define FN_setMaterialNormalize 1099 #define SETMATERIALNORMALIZE_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETMATERIALNORMALIZE_FLAG num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_materialIsNormalized 1088 +#define FN_materialIsNormalized 1100 #define MATERIALISNORMALIZED_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_setMaterialPointCloud 1089 +#define FN_setMaterialPointCloud 1101 #define SETMATERIALPOINTCLOUD_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETMATERIALPOINTCLOUD_FLAG num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_materialIsPointCloud 1090 +#define FN_materialIsPointCloud 1102 #define MATERIALISPOINTCLOUD_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_setMaterialFlag 1091 +#define FN_setMaterialFlag 1103 #define SETMATERIALFLAG_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETMATERIALFLAG_MATERIAL_FLAG num_var[1].nref[0].value[ num_var[1].byref_offset ] #define SETMATERIALFLAG_F_VALUE num_var[2].nref[0].value[ num_var[2].byref_offset ] -#define FN_getMaterialFlag 1092 +#define FN_getMaterialFlag 1104 #define GETMATERIALFLAG_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] #define GETMATERIALFLAG_MATERIAL_FLAG num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_setMaterialTexture 1093 +#define FN_setMaterialTexture 1105 #define SETMATERIALTEXTURE_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETMATERIALTEXTURE_LEVEL num_var[1].nref[0].value[ num_var[1].byref_offset ] #define SETMATERIALTEXTURE_IMG_ID num_var[2].nref[0].value[ num_var[2].byref_offset ] -#define FN_setMaterialShininess 1094 +#define FN_setMaterialShininess 1106 #define SETMATERIALSHININESS_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETMATERIALSHININESS_SHININESS num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_getMaterialShininess 1095 +#define FN_getMaterialShininess 1107 #define GETMATERIALSHININESS_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_setMaterialSpecularColor 1096 +#define FN_setMaterialSpecularColor 1108 #define SETMATERIALSPECULARCOLOR_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETMATERIALSPECULARCOLOR_COLOR num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_getMaterialSpecularColor 1097 +#define FN_getMaterialSpecularColor 1109 #define GETMATERIALSPECULARCOLOR_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_setMaterialThickness 1098 +#define FN_setMaterialThickness 1110 #define SETMATERIALTHICKNESS_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETMATERIALTHICKNESS_THICKNESS num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_getMaterialThickness 1099 +#define FN_getMaterialThickness 1111 #define GETMATERIALTHICKNESS_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_setMaterialWireframe 1100 +#define FN_setMaterialWireframe 1112 #define SETMATERIALWIREFRAME_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETMATERIALWIREFRAME_FLAG num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_materialIsWireframe 1101 +#define FN_materialIsWireframe 1113 #define MATERIALISWIREFRAME_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_setActorTexture 1102 +#define FN_setActorTexture 1114 #define SETACTORTEXTURE_ACTOR num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETACTORTEXTURE_LAYER num_var[1].nref[0].value[ num_var[1].byref_offset ] #define SETACTORTEXTURE_IMAGE_ID num_var[2].nref[0].value[ num_var[2].byref_offset ] -#define FN_getActorMaterialCount 1103 +#define FN_getActorMaterialCount 1115 #define GETACTORMATERIALCOUNT_ACTOR num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_setActorMaterialFlag 1104 +#define FN_setActorMaterialFlag 1116 #define SETACTORMATERIALFLAG_ACTOR num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETACTORMATERIALFLAG_FLAG num_var[1].nref[0].value[ num_var[1].byref_offset ] #define SETACTORMATERIALFLAG_FLAG_VALUE num_var[2].nref[0].value[ num_var[2].byref_offset ] -#define FN_getActorMaterialFlag 1105 +#define FN_getActorMaterialFlag 1117 #define GETACTORMATERIALFLAG_ACTOR num_var[0].nref[0].value[ num_var[0].byref_offset ] #define GETACTORMATERIALFLAG_MATERIAL num_var[1].nref[0].value[ num_var[1].byref_offset ] #define GETACTORMATERIALFLAG_FLAG num_var[2].nref[0].value[ num_var[2].byref_offset ] -#define FN_setActorMaterialType 1106 +#define FN_setActorMaterialType 1118 #define SETACTORMATERIALTYPE_ACTOR num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETACTORMATERIALTYPE_MATERIAL_TYPE num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_getActorMaterialType 1107 +#define FN_getActorMaterialType 1119 #define GETACTORMATERIALTYPE_ACTOR num_var[0].nref[0].value[ num_var[0].byref_offset ] #define GETACTORMATERIALTYPE_MATERIAL num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_MaterialExists 1108 +#define FN_MaterialExists 1120 #define MATERIALEXISTS_MATERIAL num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_NumMaterialConstants 1109 +#define FN_NumMaterialConstants 1121 #define NUMMATERIALCONSTANTS_MATERIAL_TYPE num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_GetMaterialConstantName$ 1110 +#define FN_GetMaterialConstantName$ 1122 #define GETMATERIALCONSTANTNAME$_MATERIAL_TYPE num_var[0].nref[0].value[ num_var[0].byref_offset ] #define GETMATERIALCONSTANTNAME$_INDEX num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_SetMaterialConstant 1111 +#define FN_SetMaterialConstant 1123 #define SETMATERIALCONSTANT_MATERIAL num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETMATERIALCONSTANT_M_CONSTANT$ str_var[0].sref[0].value[ str_var[0].byref_offset ] #define SETMATERIALCONSTANT_N1 num_var[1].nref[0].value[ num_var[1].byref_offset ] #define SETMATERIALCONSTANT_N2 num_var[2].nref[0].value[ num_var[2].byref_offset ] #define SETMATERIALCONSTANT_N3 num_var[3].nref[0].value[ num_var[3].byref_offset ] #define SETMATERIALCONSTANT_N4 num_var[4].nref[0].value[ num_var[4].byref_offset ] -#define FN_GetMaterialConstant 1112 +#define FN_GetMaterialConstant 1124 #define GETMATERIALCONSTANT_MATERIAL num_var[0].nref[0].value[ num_var[0].byref_offset ] #define GETMATERIALCONSTANT_M_CONSTANT$ str_var[0].sref[0].value[ str_var[0].byref_offset ] #define GETMATERIALCONSTANT_N1 num_var[1].nref[0].value[ num_var[1].byref_offset ] diff --git a/rcbasic_build/rcbasic_dev3.txt b/rcbasic_build/rcbasic_dev3.txt index c634b6d..d1112f5 100644 --- a/rcbasic_build/rcbasic_dev3.txt +++ b/rcbasic_build/rcbasic_dev3.txt @@ -3176,6 +3176,42 @@ case FN_SetProjectorFOV: //Sub Procedure case FN_GetProjectorFOV: //Number Function rc_push_num(rc_getProjectorFOV( GETPROJECTORFOV_ACTOR )); break; +case FN_AddCompositeChild: //Number Function + rc_push_num(rc_addCompositeChild( ADDCOMPOSITECHILD_ACTOR, ADDCOMPOSITECHILD_CHILD_ACTOR, ADDCOMPOSITECHILD_T_MATRIX )); + break; +case FN_GetCompositeChildCount: //Number Function + rc_push_num(rc_getCompositeChildCount( GETCOMPOSITECHILDCOUNT_ACTOR )); + break; +case FN_GetCompositeChild: //Number Function + rc_push_num(rc_getCompositeChild( GETCOMPOSITECHILD_ACTOR, GETCOMPOSITECHILD_CHILD_INDEX )); + break; +case FN_GetCompositeChildIndex: //Number Function + rc_push_num(rc_getCompositeChildIndex( GETCOMPOSITECHILDINDEX_ACTOR, GETCOMPOSITECHILDINDEX_CHILD_ACTOR )); + break; +case FN_RemoveCompositeChild: //Sub Procedure + rc_removeCompositeChild( REMOVECOMPOSITECHILD_ACTOR, REMOVECOMPOSITECHILD_CHILD_INDEX ); + break; +case FN_GetCompositeChildTransform: //Number Function + rc_push_num(rc_getCompositeChildTransform( GETCOMPOSITECHILDTRANSFORM_ACTOR, GETCOMPOSITECHILDTRANSFORM_CHILD_INDEX, GETCOMPOSITECHILDTRANSFORM_T_MATRIX )); + break; +case FN_GetCompositeAABB: //Number Function + rc_push_num(rc_getCompositeAABB( GETCOMPOSITEAABB_ACTOR, GETCOMPOSITEAABB_T_MATRIX, &GETCOMPOSITEAABB_MIN_X, &GETCOMPOSITEAABB_MIN_Y, &GETCOMPOSITEAABB_MIN_Z, &GETCOMPOSITEAABB_MAX_X, &GETCOMPOSITEAABB_MAX_Y, &GETCOMPOSITEAABB_MAX_Z )); + break; +case FN_RecalculateCompositeAABB: //Sub Procedure + rc_recalculateCompositeAABB( RECALCULATECOMPOSITEAABB_ACTOR ); + break; +case FN_GenerateCompositeAABBFromChildren: //Sub Procedure + rc_generateCompositeAABBFromChildren( GENERATECOMPOSITEAABBFROMCHILDREN_ACTOR ); + break; +case FN_CalculateCompositePrincipalTransform: //Sub Procedure + rc_calculateCompositePrincipalTransform( CALCULATECOMPOSITEPRINCIPALTRANSFORM_ACTOR, &CALCULATECOMPOSITEPRINCIPALTRANSFORM_MASSES, CALCULATECOMPOSITEPRINCIPALTRANSFORM_PRINCIPAL_MATRIX, &CALCULATECOMPOSITEPRINCIPALTRANSFORM_X, &CALCULATECOMPOSITEPRINCIPALTRANSFORM_Y, &CALCULATECOMPOSITEPRINCIPALTRANSFORM_Z ); + break; +case FN_UpdateCompositeChildTransform: //Sub Procedure + rc_updateCompositeChildTransform( UPDATECOMPOSITECHILDTRANSFORM_ACTOR, UPDATECOMPOSITECHILDTRANSFORM_CHILD_INDEX, UPDATECOMPOSITECHILDTRANSFORM_T_MATRIX, UPDATECOMPOSITECHILDTRANSFORM_RECALC_FLAG ); + break; +case FN_GetCompositeUpdateRevision: //Number Function + rc_push_num(rc_getCompositeUpdateRevision( GETCOMPOSITEUPDATEREVISION_ACTOR )); + break; case FN_createMaterial: //Number Function rc_push_num(rc_createMaterial( )); break; diff --git a/rcbasic_runtime/main.cpp b/rcbasic_runtime/main.cpp index bf93bc2..bdb8b18 100755 --- a/rcbasic_runtime/main.cpp +++ b/rcbasic_runtime/main.cpp @@ -4453,7 +4453,7 @@ int main(int argc, char * argv[]) //ogles2 test #ifdef RC_TESTING - rc_intern_dirChange("/home/n00b/Programs/rcbasic/examples/Sprite_Test"); + rc_intern_dirChange("/home/n00b/Music/v47/RCBasic_v47_Linux64/examples/Sprite_Test"); //rc_intern_dirChange(""); rc_filename = "main.cbc"; diff --git a/rcbasic_runtime/rc_defines.h b/rcbasic_runtime/rc_defines.h index f25bf33..83aacb6 100755 --- a/rcbasic_runtime/rc_defines.h +++ b/rcbasic_runtime/rc_defines.h @@ -3311,175 +3311,221 @@ #define SETPROJECTORFOV_FOV num_var[1].nref[0].value[ num_var[1].byref_offset ] #define FN_GetProjectorFOV 1049 #define GETPROJECTORFOV_ACTOR num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_createMaterial 1050 -#define FN_deleteMaterial 1051 +#define FN_AddCompositeChild 1050 +#define ADDCOMPOSITECHILD_ACTOR num_var[0].nref[0].value[ num_var[0].byref_offset ] +#define ADDCOMPOSITECHILD_CHILD_ACTOR num_var[1].nref[0].value[ num_var[1].byref_offset ] +#define ADDCOMPOSITECHILD_T_MATRIX num_var[2].nref[0].value[ num_var[2].byref_offset ] +#define FN_GetCompositeChildCount 1051 +#define GETCOMPOSITECHILDCOUNT_ACTOR num_var[0].nref[0].value[ num_var[0].byref_offset ] +#define FN_GetCompositeChild 1052 +#define GETCOMPOSITECHILD_ACTOR num_var[0].nref[0].value[ num_var[0].byref_offset ] +#define GETCOMPOSITECHILD_CHILD_INDEX num_var[1].nref[0].value[ num_var[1].byref_offset ] +#define FN_GetCompositeChildIndex 1053 +#define GETCOMPOSITECHILDINDEX_ACTOR num_var[0].nref[0].value[ num_var[0].byref_offset ] +#define GETCOMPOSITECHILDINDEX_CHILD_ACTOR num_var[1].nref[0].value[ num_var[1].byref_offset ] +#define FN_RemoveCompositeChild 1054 +#define REMOVECOMPOSITECHILD_ACTOR num_var[0].nref[0].value[ num_var[0].byref_offset ] +#define REMOVECOMPOSITECHILD_CHILD_INDEX num_var[1].nref[0].value[ num_var[1].byref_offset ] +#define FN_GetCompositeChildTransform 1055 +#define GETCOMPOSITECHILDTRANSFORM_ACTOR num_var[0].nref[0].value[ num_var[0].byref_offset ] +#define GETCOMPOSITECHILDTRANSFORM_CHILD_INDEX num_var[1].nref[0].value[ num_var[1].byref_offset ] +#define GETCOMPOSITECHILDTRANSFORM_T_MATRIX num_var[2].nref[0].value[ num_var[2].byref_offset ] +#define FN_GetCompositeAABB 1056 +#define GETCOMPOSITEAABB_ACTOR num_var[0].nref[0].value[ num_var[0].byref_offset ] +#define GETCOMPOSITEAABB_T_MATRIX num_var[1].nref[0].value[ num_var[1].byref_offset ] +#define GETCOMPOSITEAABB_MIN_X num_var[2].nref[0].value[ num_var[2].byref_offset ] +#define GETCOMPOSITEAABB_MIN_Y num_var[3].nref[0].value[ num_var[3].byref_offset ] +#define GETCOMPOSITEAABB_MIN_Z num_var[4].nref[0].value[ num_var[4].byref_offset ] +#define GETCOMPOSITEAABB_MAX_X num_var[5].nref[0].value[ num_var[5].byref_offset ] +#define GETCOMPOSITEAABB_MAX_Y num_var[6].nref[0].value[ num_var[6].byref_offset ] +#define GETCOMPOSITEAABB_MAX_Z num_var[7].nref[0].value[ num_var[7].byref_offset ] +#define FN_RecalculateCompositeAABB 1057 +#define RECALCULATECOMPOSITEAABB_ACTOR num_var[0].nref[0].value[ num_var[0].byref_offset ] +#define FN_GenerateCompositeAABBFromChildren 1058 +#define GENERATECOMPOSITEAABBFROMCHILDREN_ACTOR num_var[0].nref[0].value[ num_var[0].byref_offset ] +#define FN_CalculateCompositePrincipalTransform 1059 +#define CALCULATECOMPOSITEPRINCIPALTRANSFORM_ACTOR num_var[0].nref[0].value[ num_var[0].byref_offset ] +#define CALCULATECOMPOSITEPRINCIPALTRANSFORM_MASSES num_var[1].nref[0].value[ num_var[1].byref_offset ] +#define CALCULATECOMPOSITEPRINCIPALTRANSFORM_PRINCIPAL_MATRIX num_var[2].nref[0].value[ num_var[2].byref_offset ] +#define CALCULATECOMPOSITEPRINCIPALTRANSFORM_X num_var[3].nref[0].value[ num_var[3].byref_offset ] +#define CALCULATECOMPOSITEPRINCIPALTRANSFORM_Y num_var[4].nref[0].value[ num_var[4].byref_offset ] +#define CALCULATECOMPOSITEPRINCIPALTRANSFORM_Z num_var[5].nref[0].value[ num_var[5].byref_offset ] +#define FN_UpdateCompositeChildTransform 1060 +#define UPDATECOMPOSITECHILDTRANSFORM_ACTOR num_var[0].nref[0].value[ num_var[0].byref_offset ] +#define UPDATECOMPOSITECHILDTRANSFORM_CHILD_INDEX num_var[1].nref[0].value[ num_var[1].byref_offset ] +#define UPDATECOMPOSITECHILDTRANSFORM_T_MATRIX num_var[2].nref[0].value[ num_var[2].byref_offset ] +#define UPDATECOMPOSITECHILDTRANSFORM_RECALC_FLAG num_var[3].nref[0].value[ num_var[3].byref_offset ] +#define FN_GetCompositeUpdateRevision 1061 +#define GETCOMPOSITEUPDATEREVISION_ACTOR num_var[0].nref[0].value[ num_var[0].byref_offset ] +#define FN_createMaterial 1062 +#define FN_deleteMaterial 1063 #define DELETEMATERIAL_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_setActorMaterial 1052 +#define FN_setActorMaterial 1064 #define SETACTORMATERIAL_ACTOR num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETACTORMATERIAL_MATERIAL_NUM num_var[1].nref[0].value[ num_var[1].byref_offset ] #define SETACTORMATERIAL_MATERIAL_ID num_var[2].nref[0].value[ num_var[2].byref_offset ] -#define FN_getActorMaterial 1053 +#define FN_getActorMaterial 1065 #define GETACTORMATERIAL_ACTOR num_var[0].nref[0].value[ num_var[0].byref_offset ] #define GETACTORMATERIAL_MATERIAL_NUM num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_copyActorMaterial 1054 +#define FN_copyActorMaterial 1066 #define COPYACTORMATERIAL_ACTOR num_var[0].nref[0].value[ num_var[0].byref_offset ] #define COPYACTORMATERIAL_MATERIAL_NUM num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_copyMaterial 1055 +#define FN_copyMaterial 1067 #define COPYMATERIAL_SMATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_setMaterialTextureCanvas 1056 +#define FN_setMaterialTextureCanvas 1068 #define SETMATERIALTEXTURECANVAS_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETMATERIALTEXTURECANVAS_LEVEL num_var[1].nref[0].value[ num_var[1].byref_offset ] #define SETMATERIALTEXTURECANVAS_CANVAS_ID num_var[2].nref[0].value[ num_var[2].byref_offset ] -#define FN_setMaterialAmbientColor 1057 +#define FN_setMaterialAmbientColor 1069 #define SETMATERIALAMBIENTCOLOR_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETMATERIALAMBIENTCOLOR_COLOR num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_getMaterialAmbientColor 1058 +#define FN_getMaterialAmbientColor 1070 #define GETMATERIALAMBIENTCOLOR_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_setMaterialAntiAliasing 1059 +#define FN_setMaterialAntiAliasing 1071 #define SETMATERIALANTIALIASING_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETMATERIALANTIALIASING_AA num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_getMaterialAntiAliasing 1060 +#define FN_getMaterialAntiAliasing 1072 #define GETMATERIALANTIALIASING_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_setMaterialBackfaceCulling 1061 +#define FN_setMaterialBackfaceCulling 1073 #define SETMATERIALBACKFACECULLING_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETMATERIALBACKFACECULLING_FLAG num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_getMaterialBackfaceCulling 1062 +#define FN_getMaterialBackfaceCulling 1074 #define GETMATERIALBACKFACECULLING_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_setMaterialBlendFactor 1063 +#define FN_setMaterialBlendFactor 1075 #define SETMATERIALBLENDFACTOR_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETMATERIALBLENDFACTOR_BF num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_getMaterialBlendFactor 1064 +#define FN_getMaterialBlendFactor 1076 #define GETMATERIALBLENDFACTOR_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_setMaterialBlendMode 1065 +#define FN_setMaterialBlendMode 1077 #define SETMATERIALBLENDMODE_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETMATERIALBLENDMODE_BLEND_MODE num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_getMaterialBlendMode 1066 +#define FN_getMaterialBlendMode 1078 #define GETMATERIALBLENDMODE_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_setMaterialColorMask 1067 +#define FN_setMaterialColorMask 1079 #define SETMATERIALCOLORMASK_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETMATERIALCOLORMASK_COLOR_MASK num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_getMaterialColorMask 1068 +#define FN_getMaterialColorMask 1080 #define GETMATERIALCOLORMASK_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_setMaterialColorMode 1069 +#define FN_setMaterialColorMode 1081 #define SETMATERIALCOLORMODE_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETMATERIALCOLORMODE_COLOR_MODE num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_getMaterialColorMode 1070 +#define FN_getMaterialColorMode 1082 #define GETMATERIALCOLORMODE_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_setMaterialDiffuseColor 1071 +#define FN_setMaterialDiffuseColor 1083 #define SETMATERIALDIFFUSECOLOR_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETMATERIALDIFFUSECOLOR_COLOR num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_getMaterialDiffuseColor 1072 +#define FN_getMaterialDiffuseColor 1084 #define GETMATERIALDIFFUSECOLOR_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_setMaterialEmissiveColor 1073 +#define FN_setMaterialEmissiveColor 1085 #define SETMATERIALEMISSIVECOLOR_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETMATERIALEMISSIVECOLOR_COLOR num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_getMaterialEmissiveColor 1074 +#define FN_getMaterialEmissiveColor 1086 #define GETMATERIALEMISSIVECOLOR_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_setMaterialFog 1075 +#define FN_setMaterialFog 1087 #define SETMATERIALFOG_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETMATERIALFOG_FLAG num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_getMaterialFog 1076 +#define FN_getMaterialFog 1088 #define GETMATERIALFOG_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_setMaterialFrontfaceCulling 1077 +#define FN_setMaterialFrontfaceCulling 1089 #define SETMATERIALFRONTFACECULLING_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETMATERIALFRONTFACECULLING_FLAG num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_getMaterialFrontfaceCulling 1078 +#define FN_getMaterialFrontfaceCulling 1090 #define GETMATERIALFRONTFACECULLING_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_setMaterialGouraudShading 1079 +#define FN_setMaterialGouraudShading 1091 #define SETMATERIALGOURAUDSHADING_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETMATERIALGOURAUDSHADING_FLAG num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_materialIsGouraudShaded 1080 +#define FN_materialIsGouraudShaded 1092 #define MATERIALISGOURAUDSHADED_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_materialIsAplhaBlend 1081 +#define FN_materialIsAplhaBlend 1093 #define MATERIALISAPLHABLEND_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_materialIsTransparent 1082 +#define FN_materialIsTransparent 1094 #define MATERIALISTRANSPARENT_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_setMaterialLighting 1083 +#define FN_setMaterialLighting 1095 #define SETMATERIALLIGHTING_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETMATERIALLIGHTING_FLAG num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_materialIsLit 1084 +#define FN_materialIsLit 1096 #define MATERIALISLIT_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_setMaterialType 1085 +#define FN_setMaterialType 1097 #define SETMATERIALTYPE_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETMATERIALTYPE_MAT_TYPE num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_getMaterialType 1086 +#define FN_getMaterialType 1098 #define GETMATERIALTYPE_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_setMaterialNormalize 1087 +#define FN_setMaterialNormalize 1099 #define SETMATERIALNORMALIZE_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETMATERIALNORMALIZE_FLAG num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_materialIsNormalized 1088 +#define FN_materialIsNormalized 1100 #define MATERIALISNORMALIZED_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_setMaterialPointCloud 1089 +#define FN_setMaterialPointCloud 1101 #define SETMATERIALPOINTCLOUD_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETMATERIALPOINTCLOUD_FLAG num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_materialIsPointCloud 1090 +#define FN_materialIsPointCloud 1102 #define MATERIALISPOINTCLOUD_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_setMaterialFlag 1091 +#define FN_setMaterialFlag 1103 #define SETMATERIALFLAG_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETMATERIALFLAG_MATERIAL_FLAG num_var[1].nref[0].value[ num_var[1].byref_offset ] #define SETMATERIALFLAG_F_VALUE num_var[2].nref[0].value[ num_var[2].byref_offset ] -#define FN_getMaterialFlag 1092 +#define FN_getMaterialFlag 1104 #define GETMATERIALFLAG_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] #define GETMATERIALFLAG_MATERIAL_FLAG num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_setMaterialTexture 1093 +#define FN_setMaterialTexture 1105 #define SETMATERIALTEXTURE_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETMATERIALTEXTURE_LEVEL num_var[1].nref[0].value[ num_var[1].byref_offset ] #define SETMATERIALTEXTURE_IMG_ID num_var[2].nref[0].value[ num_var[2].byref_offset ] -#define FN_setMaterialShininess 1094 +#define FN_setMaterialShininess 1106 #define SETMATERIALSHININESS_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETMATERIALSHININESS_SHININESS num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_getMaterialShininess 1095 +#define FN_getMaterialShininess 1107 #define GETMATERIALSHININESS_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_setMaterialSpecularColor 1096 +#define FN_setMaterialSpecularColor 1108 #define SETMATERIALSPECULARCOLOR_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETMATERIALSPECULARCOLOR_COLOR num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_getMaterialSpecularColor 1097 +#define FN_getMaterialSpecularColor 1109 #define GETMATERIALSPECULARCOLOR_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_setMaterialThickness 1098 +#define FN_setMaterialThickness 1110 #define SETMATERIALTHICKNESS_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETMATERIALTHICKNESS_THICKNESS num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_getMaterialThickness 1099 +#define FN_getMaterialThickness 1111 #define GETMATERIALTHICKNESS_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_setMaterialWireframe 1100 +#define FN_setMaterialWireframe 1112 #define SETMATERIALWIREFRAME_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETMATERIALWIREFRAME_FLAG num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_materialIsWireframe 1101 +#define FN_materialIsWireframe 1113 #define MATERIALISWIREFRAME_MATERIAL_ID num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_setActorTexture 1102 +#define FN_setActorTexture 1114 #define SETACTORTEXTURE_ACTOR num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETACTORTEXTURE_LAYER num_var[1].nref[0].value[ num_var[1].byref_offset ] #define SETACTORTEXTURE_IMAGE_ID num_var[2].nref[0].value[ num_var[2].byref_offset ] -#define FN_getActorMaterialCount 1103 +#define FN_getActorMaterialCount 1115 #define GETACTORMATERIALCOUNT_ACTOR num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_setActorMaterialFlag 1104 +#define FN_setActorMaterialFlag 1116 #define SETACTORMATERIALFLAG_ACTOR num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETACTORMATERIALFLAG_FLAG num_var[1].nref[0].value[ num_var[1].byref_offset ] #define SETACTORMATERIALFLAG_FLAG_VALUE num_var[2].nref[0].value[ num_var[2].byref_offset ] -#define FN_getActorMaterialFlag 1105 +#define FN_getActorMaterialFlag 1117 #define GETACTORMATERIALFLAG_ACTOR num_var[0].nref[0].value[ num_var[0].byref_offset ] #define GETACTORMATERIALFLAG_MATERIAL num_var[1].nref[0].value[ num_var[1].byref_offset ] #define GETACTORMATERIALFLAG_FLAG num_var[2].nref[0].value[ num_var[2].byref_offset ] -#define FN_setActorMaterialType 1106 +#define FN_setActorMaterialType 1118 #define SETACTORMATERIALTYPE_ACTOR num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETACTORMATERIALTYPE_MATERIAL_TYPE num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_getActorMaterialType 1107 +#define FN_getActorMaterialType 1119 #define GETACTORMATERIALTYPE_ACTOR num_var[0].nref[0].value[ num_var[0].byref_offset ] #define GETACTORMATERIALTYPE_MATERIAL num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_MaterialExists 1108 +#define FN_MaterialExists 1120 #define MATERIALEXISTS_MATERIAL num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_NumMaterialConstants 1109 +#define FN_NumMaterialConstants 1121 #define NUMMATERIALCONSTANTS_MATERIAL_TYPE num_var[0].nref[0].value[ num_var[0].byref_offset ] -#define FN_GetMaterialConstantName$ 1110 +#define FN_GetMaterialConstantName$ 1122 #define GETMATERIALCONSTANTNAME$_MATERIAL_TYPE num_var[0].nref[0].value[ num_var[0].byref_offset ] #define GETMATERIALCONSTANTNAME$_INDEX num_var[1].nref[0].value[ num_var[1].byref_offset ] -#define FN_SetMaterialConstant 1111 +#define FN_SetMaterialConstant 1123 #define SETMATERIALCONSTANT_MATERIAL num_var[0].nref[0].value[ num_var[0].byref_offset ] #define SETMATERIALCONSTANT_M_CONSTANT$ str_var[0].sref[0].value[ str_var[0].byref_offset ] #define SETMATERIALCONSTANT_N1 num_var[1].nref[0].value[ num_var[1].byref_offset ] #define SETMATERIALCONSTANT_N2 num_var[2].nref[0].value[ num_var[2].byref_offset ] #define SETMATERIALCONSTANT_N3 num_var[3].nref[0].value[ num_var[3].byref_offset ] #define SETMATERIALCONSTANT_N4 num_var[4].nref[0].value[ num_var[4].byref_offset ] -#define FN_GetMaterialConstant 1112 +#define FN_GetMaterialConstant 1124 #define GETMATERIALCONSTANT_MATERIAL num_var[0].nref[0].value[ num_var[0].byref_offset ] #define GETMATERIALCONSTANT_M_CONSTANT$ str_var[0].sref[0].value[ str_var[0].byref_offset ] #define GETMATERIALCONSTANT_N1 num_var[1].nref[0].value[ num_var[1].byref_offset ] diff --git a/rcbasic_runtime/rc_func130_cases.h b/rcbasic_runtime/rc_func130_cases.h index ed40b7e..6ba2971 100644 --- a/rcbasic_runtime/rc_func130_cases.h +++ b/rcbasic_runtime/rc_func130_cases.h @@ -3176,6 +3176,42 @@ case FN_SetProjectorFOV: //Sub Procedure case FN_GetProjectorFOV: //Number Function rc_push_num(rc_getProjectorFOV( GETPROJECTORFOV_ACTOR )); break; +case FN_AddCompositeChild: //Number Function + rc_push_num(rc_addCompositeChild( ADDCOMPOSITECHILD_ACTOR, ADDCOMPOSITECHILD_CHILD_ACTOR, ADDCOMPOSITECHILD_T_MATRIX )); + break; +case FN_GetCompositeChildCount: //Number Function + rc_push_num(rc_getCompositeChildCount( GETCOMPOSITECHILDCOUNT_ACTOR )); + break; +case FN_GetCompositeChild: //Number Function + rc_push_num(rc_getCompositeChild( GETCOMPOSITECHILD_ACTOR, GETCOMPOSITECHILD_CHILD_INDEX )); + break; +case FN_GetCompositeChildIndex: //Number Function + rc_push_num(rc_getCompositeChildIndex( GETCOMPOSITECHILDINDEX_ACTOR, GETCOMPOSITECHILDINDEX_CHILD_ACTOR )); + break; +case FN_RemoveCompositeChild: //Sub Procedure + rc_removeCompositeChild( REMOVECOMPOSITECHILD_ACTOR, REMOVECOMPOSITECHILD_CHILD_INDEX ); + break; +case FN_GetCompositeChildTransform: //Number Function + rc_push_num(rc_getCompositeChildTransform( GETCOMPOSITECHILDTRANSFORM_ACTOR, GETCOMPOSITECHILDTRANSFORM_CHILD_INDEX, GETCOMPOSITECHILDTRANSFORM_T_MATRIX )); + break; +case FN_GetCompositeAABB: //Number Function + rc_push_num(rc_getCompositeAABB( GETCOMPOSITEAABB_ACTOR, GETCOMPOSITEAABB_T_MATRIX, &GETCOMPOSITEAABB_MIN_X, &GETCOMPOSITEAABB_MIN_Y, &GETCOMPOSITEAABB_MIN_Z, &GETCOMPOSITEAABB_MAX_X, &GETCOMPOSITEAABB_MAX_Y, &GETCOMPOSITEAABB_MAX_Z )); + break; +case FN_RecalculateCompositeAABB: //Sub Procedure + rc_recalculateCompositeAABB( RECALCULATECOMPOSITEAABB_ACTOR ); + break; +case FN_GenerateCompositeAABBFromChildren: //Sub Procedure + rc_generateCompositeAABBFromChildren( GENERATECOMPOSITEAABBFROMCHILDREN_ACTOR ); + break; +case FN_CalculateCompositePrincipalTransform: //Sub Procedure + rc_calculateCompositePrincipalTransform( CALCULATECOMPOSITEPRINCIPALTRANSFORM_ACTOR, &CALCULATECOMPOSITEPRINCIPALTRANSFORM_MASSES, CALCULATECOMPOSITEPRINCIPALTRANSFORM_PRINCIPAL_MATRIX, &CALCULATECOMPOSITEPRINCIPALTRANSFORM_X, &CALCULATECOMPOSITEPRINCIPALTRANSFORM_Y, &CALCULATECOMPOSITEPRINCIPALTRANSFORM_Z ); + break; +case FN_UpdateCompositeChildTransform: //Sub Procedure + rc_updateCompositeChildTransform( UPDATECOMPOSITECHILDTRANSFORM_ACTOR, UPDATECOMPOSITECHILDTRANSFORM_CHILD_INDEX, UPDATECOMPOSITECHILDTRANSFORM_T_MATRIX, UPDATECOMPOSITECHILDTRANSFORM_RECALC_FLAG ); + break; +case FN_GetCompositeUpdateRevision: //Number Function + rc_push_num(rc_getCompositeUpdateRevision( GETCOMPOSITEUPDATEREVISION_ACTOR )); + break; case FN_createMaterial: //Number Function rc_push_num(rc_createMaterial( )); break; diff --git a/rcbasic_runtime/rc_os_defines.h b/rcbasic_runtime/rc_os_defines.h index 928b6d4..b28714c 100755 --- a/rcbasic_runtime/rc_os_defines.h +++ b/rcbasic_runtime/rc_os_defines.h @@ -2,7 +2,7 @@ #define RC_OS_DEFINES_H_INCLUDED //USED FOR TESTING ONLY -//#define RC_TESTING +#define RC_TESTING //I am checking Android first since I think it also defines __linux__ diff --git a/rcbasic_runtime/rc_sprite2D.h b/rcbasic_runtime/rc_sprite2D.h index c981736..1b38a9a 100755 --- a/rcbasic_runtime/rc_sprite2D.h +++ b/rcbasic_runtime/rc_sprite2D.h @@ -45,6 +45,8 @@ struct rc_sprite2D_physics_obj struct rc_sprite2D_animation_obj { + int src_image_id; + irr::core::array frames; int num_frames; diff --git a/rcbasic_runtime/rc_spritelib.h b/rcbasic_runtime/rc_spritelib.h index 5f45b06..1a05c8e 100644 --- a/rcbasic_runtime/rc_spritelib.h +++ b/rcbasic_runtime/rc_spritelib.h @@ -23,10 +23,14 @@ int rc_createSpriteAnimation(int spr_id, int anim_length, double fps) if(!rc_sprite[spr_id].active) return -1; + if(rc_sprite[spr_id].image_id < 0 || rc_sprite[spr_id].image_id >= rc_image.size()) + return -1; + if(anim_length <= 0) anim_length = 1; rc_sprite2D_animation_obj animation; + animation.src_image_id = rc_sprite[spr_id].image_id; animation.current_frame = 0; animation.fps = fps; animation.frame_swap_time = 1000/fps; @@ -312,6 +316,21 @@ bool rc_spriteExists(int spr_id) return rc_sprite[spr_id].active; } +void rc_getSpriteBoxVertices(int spr_id) +{ + b2PolygonShape* shape = (b2PolygonShape*)rc_sprite[spr_id].physics.fixture->GetShape(); + + int m_count = shape->m_count; + + rc_sprite[spr_id].physics.vertices.clear(); + + for(int i = 0; i < m_count; i++) + { + rc_sprite[spr_id].physics.vertices.push_back(shape->m_vertices[i]); + } + +} + int rc_createSprite(int img_id, double w, double h) { if(rc_active_canvas < 0 || rc_active_canvas >= rc_canvas.size()) @@ -384,6 +403,8 @@ int rc_createSprite(int img_id, double w, double h) rc_sprite[spr_id].physics.body->SetTransform(b2Vec2(w/2, h/2), 0); + rc_getSpriteBoxVertices(spr_id); + rc_sprite[spr_id].physics.base_offset_x = w/2; rc_sprite[spr_id].physics.base_offset_y = h/2; @@ -445,6 +466,18 @@ void rc_deleteSprite(int spr_id) rc_canvas[rc_sprite[spr_id].parent_canvas].physics2D.world->DestroyBody(rc_sprite[spr_id].physics.body); } } + else + { + int parent_id = rc_sprite[spr_id].parent_sprite; + + if(parent_id >= 0 && parent_id < rc_sprite.size()) + { + if(rc_sprite[parent_id].physics.body) + { + rc_sprite[parent_id].physics.body->DestroyFixture(rc_sprite[spr_id].physics.fixture); + } + } + } rc_sprite[spr_id].physics.body = NULL; } @@ -455,6 +488,8 @@ void rc_deleteSprite(int spr_id) rc_sprite[spr_id].animation.clear(); rc_sprite[spr_id].child_sprites.clear(); rc_sprite[spr_id].parent_sprite = -1; + rc_sprite[spr_id].physics.fixture = NULL; + rc_sprite[spr_id].physics.body = NULL; //std::cout << "DEBUG: Clear " << spr_id << " From " << parent_canvas << std::endl; @@ -503,10 +538,24 @@ int rc_addSpriteChild(int spr_id, int child_sprite_id, double x, double y) int v_count = rc_sprite[child_sprite_id].physics.vertices.size(); b2Vec2 vert[v_count]; + b2PolygonShape* n = (b2PolygonShape*)rc_sprite[spr_id].physics.fixture->GetShape(); + + //std::cout << "V_COUNT = " << v_count << ", " << n->m_count << std::endl; + + for(int i = 0; i < v_count; i++) + { + vert[i] = n->m_vertices[i]; + //std::cout << "S_OUT: " << vert[i].x << ", " << vert[i].y << std::endl; + } + for(int i = 0; i < v_count; i++) { vert[i] = b2Mul(t, rc_sprite[child_sprite_id].physics.vertices[i]); + + //std::cout << "V_OUT: " << vert[i].x << ", " << vert[i].y << std::endl; } + + shape->Set(vert, v_count); } break; @@ -543,9 +592,12 @@ int rc_addSpriteChild(int spr_id, int child_sprite_id, double x, double y) break; } + childFixtureDef.isSensor = !rc_sprite[child_sprite_id].isSolid; rc_sprite[child_sprite_id].physics.fixture = rc_sprite[spr_id].physics.body->CreateFixture(&childFixtureDef); rc_sprite[child_sprite_id].physics.fixture_def = childFixtureDef; + rc_sprite[child_sprite_id].physics.fixture_offset_x = x; + rc_sprite[child_sprite_id].physics.fixture_offset_y = y; if(rc_sprite[child_sprite_id].physics.body) { @@ -645,25 +697,27 @@ void rc_removeSpriteChild(int spr_id, int child_index) } - b2BodyDef sprBodyDef; - int frame_w = rc_sprite[child_sprite_id].frame_size.Width; int frame_h = rc_sprite[child_sprite_id].frame_size.Height; float body_x = rc_sprite[child_sprite_id].physics.body->GetPosition().x; float body_y = rc_sprite[child_sprite_id].physics.body->GetPosition().y; - int x = body_x + rc_sprite[child_sprite_id].physics.fixture_offset_x; - int y = body_y + rc_sprite[child_sprite_id].physics.fixture_offset_y; + int x = body_x + rc_sprite[child_sprite_id].physics.fixture_offset_x;// - (frame_w/2); + int y = body_y + rc_sprite[child_sprite_id].physics.fixture_offset_y;// - (frame_h/2); rc_sprite[spr_id].physics.body->DestroyFixture(rc_sprite[child_sprite_id].physics.fixture); + b2BodyDef sprBodyDef; sprBodyDef.type = b2_dynamicBody; sprBodyDef.position.Set(x, y); sprBodyDef.angle = angle; sprBodyDef.userData.pointer = child_sprite_id; - rc_sprite[child_sprite_id].physics.body = rc_canvas[rc_active_canvas].physics2D.world->CreateBody(&sprBodyDef); + + int parent_canvas = rc_sprite[child_sprite_id].parent_canvas; + + rc_sprite[child_sprite_id].physics.body = rc_canvas[parent_canvas].physics2D.world->CreateBody(&sprBodyDef); rc_sprite[child_sprite_id].isSolid = rc_sprite[spr_id].isSolid; childFixtureDef.isSensor = !rc_sprite[child_sprite_id].isSolid; @@ -787,6 +841,8 @@ void rc_setSpriteCollisionShape(int spr_id, int sprite_shape) float center_x = actual_x + (rc_sprite[spr_id].physics.offset_x + rc_sprite[spr_id].physics.user_offset_x); float center_y = actual_y + (rc_sprite[spr_id].physics.offset_y + rc_sprite[spr_id].physics.user_offset_y); rc_sprite[spr_id].physics.body->SetTransform(b2Vec2(center_x, center_y), rc_sprite[spr_id].physics.body->GetAngle()); + + rc_getSpriteBoxVertices(spr_id); } break; @@ -999,6 +1055,8 @@ void rc_setSpriteBox(int spr_id, int w, int h) rc_sprite[spr_id].physics.body->SetTransform(b2Vec2(bx + off_x, by + off_y), rc_sprite[spr_id].physics.body->GetAngle()); rc_sprite[spr_id].physics.fixture_def = sprFixtureDef; + + rc_getSpriteBoxVertices(spr_id); } } @@ -2195,6 +2253,7 @@ void drawSprites(int canvas_id) if(rc_sprite[spr_id].parent_sprite >= 0 && rc_sprite[spr_id].parent_sprite < rc_sprite.size()) { + //std::cout << "ADD OFFSET: " << rc_sprite[spr_id].physics.fixture_offset_x << ", " << rc_sprite[spr_id].physics.fixture_offset_y << std::endl; x += rc_sprite[spr_id].physics.fixture_offset_x; y += rc_sprite[spr_id].physics.fixture_offset_y; } @@ -2265,12 +2324,19 @@ void drawSprites(int canvas_id) continue; } - int img_id = sprite->image_id; - if(img_id < 0 || img_id >= rc_image.size()) - continue; + int img_id = -1; //src_size = rc_image[img_id].image->getSize(); int current_animation = sprite->current_animation; + + if(current_animation < 0 || current_animation >= sprite->animation.size()) + continue; + + img_id = sprite->animation[current_animation].src_image_id; + + if(img_id < 0 || img_id >= rc_image.size()) + continue; + if((spr_timer - sprite->animation[current_animation].frame_start_time) >= sprite->animation[current_animation].frame_swap_time) { sprite->animation[current_animation].current_frame++; diff --git a/rcbasic_runtime/rcbasic_runtime.depend b/rcbasic_runtime/rcbasic_runtime.depend index 5adbbc7..10defbe 100755 --- a/rcbasic_runtime/rcbasic_runtime.depend +++ b/rcbasic_runtime/rcbasic_runtime.depend @@ -1,5 +1,5 @@ # depslib dependency file v1.0 -1769580220 source:/home/n00b/Projects/RCBASIC4/rcbasic_runtime/main.cpp +1771296134 source:/home/n00b/Projects/RCBASIC4/rcbasic_runtime/main.cpp "rc_os_defines.h" @@ -34,10 +34,10 @@ "rc_func130_cases.h" -1771292229 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_os_defines.h +1771296059 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_os_defines.h -1771232878 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_defines.h +1771309547 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_defines.h 1764140917 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_stdlib.h "rc_os_defines.h" @@ -1310,7 +1310,7 @@ -1771199261 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_sprite2D.h +1771301815 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_sprite2D.h @@ -2281,7 +2281,7 @@ "rc_gfx_core.h" -1771232878 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_func130_cases.h +1771309547 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_func130_cases.h 1760243468 source:/home/n00b/Projects/irrBullet/src/irrBullet.cpp "irrBullet.h" @@ -2503,7 +2503,7 @@ -1771236229 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_spritelib.h +1771302491 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_spritelib.h "SDL.h" "rc_sprite2D.h"