ispringctrl.h

Go to the documentation of this file.
00001 /**********************************************************************
00002  *<
00003     FILE: jiggleAPI.h
00004 
00005     DESCRIPTION:    Public header file for Spring controller
00006 
00007     CREATED BY:     Adam Felt
00008 
00009     HISTORY: 
00010 
00011  *> Copyright (c) 1999-2000, All Rights Reserved.
00012  **********************************************************************/
00013 #pragma once
00014 
00015 #include "springsys.h"
00016 #include "ifnpub.h"
00017 
00018 
00019 #define JIGGLEPOS 0x79697d2a
00020 #define JIGGLEP3 0x13892172
00021 
00022 #define JIGGLE_POS_CLASS_ID Class_ID(JIGGLEPOS, 0xf2b8a1c8)
00023 #define JIGGLE_P3_CLASS_ID  Class_ID(JIGGLEP3, 0x68976279)
00024 
00025 #define JIGGLE_CONTROL_REF  0
00026 #define JIGGLE_PBLOCK_REF1  1
00027 #define JIGGLE_PBLOCK_REF2  2
00028 
00029 //parameter defaults
00030 #define JIGGLE_DEFAULT_TENSION 2.0f
00031 #define JIGGLE_DEFAULT_DAMPENING 0.5f
00032 #define JIGGLE_DEFAULT_MASS 300.0f
00033 #define JIGGLE_DEFAULT_DRAG 1.0f
00034 
00035 #define SET_PARAMS_RELATIVE  0
00036 #define SET_PARAMS_ABSOLUTE  1
00037 
00038 #define SPRING_CONTROLLER_INTERFACE Interface_ID(0x4c212b2e, 0x680828ab)
00039 
00051 class IJiggle : public FPMixinInterface
00052 {
00053     public:
00054         enum { get_mass, set_mass, get_drag, set_drag, get_tension, set_tension, get_dampening, set_dampening,
00055                add_spring, get_spring_count, remove_spring_by_index, remove_spring, get_spring_system, };
00056 
00057         BEGIN_FUNCTION_MAP
00058             FN_0    (get_mass, TYPE_FLOAT, GetMass);
00059             VFN_1   (set_mass, SetMass, TYPE_FLOAT);
00060             FN_0    (get_drag, TYPE_FLOAT, GetDrag);
00061             VFN_1   (set_drag, SetDrag, TYPE_FLOAT);
00062             FN_1    (get_tension, TYPE_FLOAT, GetTension, TYPE_INDEX);
00063             VFN_2   (set_tension, SetTension, TYPE_INDEX, TYPE_FLOAT);
00064             FN_1    (get_dampening, TYPE_FLOAT, GetDampening, TYPE_INDEX);
00065             VFN_2   (set_dampening, SetDampening, TYPE_INDEX, TYPE_FLOAT);
00066 
00067             FN_1    (add_spring, TYPE_BOOL, AddSpring, TYPE_INODE);
00068             FN_0    (get_spring_count, TYPE_INT, GetSpringCount);
00069             VFN_1   (remove_spring_by_index, RemoveSpring, TYPE_INDEX);
00070             VFN_1   (remove_spring, RemoveSpring, TYPE_INODE);
00071             //FN_0  (get_spring_system, TYPE_INTERFACE, GetSpringSystem);
00072         END_FUNCTION_MAP
00073 
00074         FPInterfaceDesc* GetDesc();    // <-- must implement 
00075         
00076         SpringSys* partsys;
00079         virtual SpringSys* GetSpringSystem()=0;
00080 
00082         virtual float   GetMass()=0;
00089         virtual void    SetMass(float mass, bool update=true)=0;
00091         virtual float   GetDrag()=0;
00098         virtual void    SetDrag(float drag, bool update=true)=0;
00104         virtual float   GetTension(int index)=0;
00116         virtual void    SetTension(int index, float tension, int absolute=1, bool update=true)=0;
00122         virtual float   GetDampening(int index)=0;
00134         virtual void    SetDampening(int index, float dampening, int absolute=1, bool update=true)=0;
00135 
00141         virtual BOOL    AddSpring(INode *node)=0;
00144         virtual INT     GetSpringCount()=0;
00150         virtual void    RemoveSpring(int which)=0;
00156         virtual void    RemoveSpring(INode *node)=0;
00157 };
00158