/* * Biped character class * * Copyright (C) 2008-2010 Hugo Mendieta Pacheco & Alejandro Valenzuela Roca * * scherezar_crusade@hotmail.com, lanjoe9@mexinetica.com * * This file is part of MotorJ, a free framework for videogame development. * * * * MotorJ is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * MotorJ is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with MotorJ. If not, see . */ #ifdef NINTENDO_DS #include #else #ifdef VISUAL_STUDIO #include #endif #include #endif #ifdef NINTENDO_WII #include "wii_only/gl2gxtrans.h" #endif #ifndef BIPED_CLASS_H #define BIPED_CLASS_H #include "support.h" //FIXME: make a version for gl and another for Wii #ifdef NINTENDO_DS enum mjBipedUpperAction{BIPEDU_INACTIVE, BIPEDU_WALK, BIPEDU_RUN, BIPEDU_JMP_FALL, BIPEDU_PUNCH}; enum mjBipedLowerAction{BIPEDL_INACTIVE, BIPEDL_WALK, BIPEDL_RUN, BIPEDL_JMP_FALL};//, BIPEDL_PUNCH}; typedef struct { u32 * DLHead; vector3 headPos; u32 * DLRightArm; vector3 rightArmPos; u32 * DLLeftArm; vector3 leftArmPos; u32 * DLRightElbow; vector3 rightElbowPos; u32 * DLLeftElbow; vector3 leftElbowPos; u32 * DLRightFoot; vector3 rightFootPos; u32 * DLLeftFoot; vector3 leftFootPos; u32 * DLRightWrist; vector3 rightWristPos; u32 * DLLeftWrist; vector3 leftWristPos; u32 * DLRightKnee; vector3 rightKneePos; u32 * DLLeftKnee; vector3 leftKneePos; u32 * DLRightThigh; vector3 rightThighPos; u32 * DLLeftThigh; vector3 leftThighPos; u32 * DLTorax; vector3 toraxPos; u32 * DLWaist; vector3 waistPos; } mjBipedDef ; typedef struct{ float head_x; float head_z; float head_rot; float rightArm_x; float rightArm_z; float rightArm_rot; float leftArm_x; float leftArm_z; float leftArm_rot; float rightElbow_x; float rightElbow_rot; float leftElbow_x; float leftElbow_rot; float rightFoot_z; float rightFoot_rot; float leftFoot_z; float leftFoot_rot; float leftKnee_z; float rightKnee_z; float leftWrist_x; float rightWrist_x; float rightThigh_x; float rightThigh_z; float rightThigh_rot; float leftThigh_x; float leftThigh_z; float leftThigh_rot; float toraxFlex_x; float toraxFlex_z; float torax_rot; float upperFrame; float lowerFrame; } mjBipedAngles ; class mjBiped{ public: void SetDef(mjBipedDef * def); void SetAng(mjBipedAngles * ang); void SetAngles( float h_x, float h_z, float h_r, //3 float ra_x, float ra_z, float ra_r, float la_x, float la_r, float la_z, //6 float re_x, float re_r, float le_x, float le_r, //4 float rf_z, float rf_r, float lf_z, float lf_r, //4 float lk_z, float rk_z, float lw_x, float rw_x, //4 float rt_x, float rt_z, float rt_r, float lt_x, float lt_z, float lt_r, //6 float tf_x, float tf_z, float t_r); //3 // void SetDefaultAngles(mjBipedAngles * ang); void Animate(mjBipedUpperAction upperAction,mjBipedLowerAction lowerAction,float t_elapsed); void Draw(); void SetUpperFrame(float upperFrame); void SetLowerFrame(float lowerFrame); private: mjBipedDef * iDef; mjBipedAngles * iAng; }; #endif #endif