本文整理汇总了C++中ParticleSystem::addForce方法的典型用法代码示例。如果您正苦于以下问题:C++ ParticleSystem::addForce方法的具体用法?C++ ParticleSystem::addForce怎么用?C++ ParticleSystem::addForce使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParticleSystem
的用法示例。
在下文中一共展示了ParticleSystem::addForce方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
ModelerControl controls[NUMCONTROLS ];
controls[BASE_ROTATION] = ModelerControl("base rotation (theta)", -180.0, 180.0, 0.1, 0.0 );
controls[LOWER_TILT] = ModelerControl("lower arm tilt (phi)", 15.0, 95.0, 0.1, 55.0 );
controls[UPPER_TILT] = ModelerControl("upper arm tilt (psi)", 0.0, 135.0, 0.1, 30.0 );
controls[CLAW_ROTATION] = ModelerControl("claw rotation (cr)", -30.0, 180.0, 0.1, 0.0 );
controls[BASE_LENGTH] = ModelerControl("base height (h1)", 0.5, 10.0, 0.1, 0.8 );
controls[LOWER_LENGTH] = ModelerControl("lower arm length (h2)", 1, 10.0, 0.1, 3.0 );
controls[UPPER_LENGTH] = ModelerControl("upper arm length (h3)", 1, 10.0, 0.1, 2.5);
controls[PARTICLE_COUNT] = ModelerControl("particle count (pc)", 0.0, 5.0, 0.1, 5.0);
controls[X_WIND] = ModelerControl("X_WIND", 0.0, 5.0, 0.1, 0.6);
controls[Y_WIND] = ModelerControl("Y_WIND", 0.0, 5.0, 0.1, 0.0);
controls[Z_WIND] = ModelerControl("Z_WIND", 0.0, 5.0, 0.1, 0.2);
controls[WIND_MAGNITUDE] = ModelerControl("WIND_MAGNITUDE", 0.0, 10.0, 0.1, 2.0);
controls[GRAVITY] = ModelerControl("GRAVITY", -10.0, 10.0, 1.0, 9.8);
controls[XPOS] = ModelerControl("X Position", -5, 5, 0.1f, 0);
controls[YPOS] = ModelerControl("Y Position", 0, 5, 0.1f, 0);
controls[ZPOS] = ModelerControl("Z Position", -5, 5, 0.1f, 0);
controls[XSCALE] = ModelerControl("X Scale", 0, 3, 0.1f, 1.0f);
controls[YSCALE] = ModelerControl("Y Scale", 0, 3, 0.1f, 1.0f);
controls[ZSCALE] = ModelerControl("Z Scale", 0, 3, 0.1f, 1.0f);
controls[HEIGHT] = ModelerControl("Height", 1, 2.5, 0.1f, 1);
controls[ROTATE] = ModelerControl("Rotate", -135, 135, 1, 0);
controls[HEAD_SIZE] = ModelerControl("Head Size", 0.8, 2, 0.1f, 1);
controls[HEAD_ROTATE] = ModelerControl("Head Rotate", -70, 70, 1, 0);
controls[EAR_SIZE] = ModelerControl("Ear Size", 0, 2, 0.1f, 1);
controls[UPPER_ARM_LENGTH] = ModelerControl("Upper Arm Length", 1, 5, 0.1f, 0.8);
controls[LEFT_UPPER_ARM_ROTATE_X] = ModelerControl("Left Upper Arm Rotate X", 20, 120, 1.0f, 80);
controls[LEFT_UPPER_ARM_ROTATE_Y] = ModelerControl("Left Upper Arm Rotate Y", -30, 90, 1.0f, 0);
controls[RIGHT_UPPER_ARM_ROTATE_X] = ModelerControl("Right Upper Arm Rotate X", -90, 100, 1.0f, -40);
controls[RIGHT_UPPER_ARM_ROTATE_Y] = ModelerControl("Right Upper Arm Rotate Y", -90, 30, 1.0f, 0);
controls[LOWER_ARM_LENGTH] = ModelerControl("Lower Arm Length", 1, 5, 0.1f, 0.8);
controls[LEFT_LOWER_ARM_ROTATE] = ModelerControl("Left Lower Arm Rotate", 20, 180, 1.0f, 80);
controls[RIGHT_LOWER_ARM_ROTATE] = ModelerControl("Right Lower Arm Rotate", 20, 180, 1.0f, 180);
controls[RIGHT_HAND_ANGLE] = ModelerControl("Right Hand Angle", 0, 70, 1, 0);
controls[LEFT_HAND_ANGLE] = ModelerControl("Left Hand Angle", 0, 70, 1, 0);
controls[LEG_LENGTH] = ModelerControl("Leg Length", 1, 5, 0.1f, 2);
controls[LEFT_LEG_ROTATE_X] = ModelerControl("Left Leg Rotate X", 30, 150, 1.0f, 40);
controls[LEFT_LEG_ROTATE_Y] = ModelerControl("Left Leg Rotate Y", -80, 90, 1.0f, 0);
controls[RIGHT_LEG_ROTATE_X] = ModelerControl("Right Leg Rotate X", 30, 150, 1.0f, 140);
controls[RIGHT_LEG_ROTATE_Y] = ModelerControl("Right Leg Rotate Y", -90, 80, 1.0f, 0);
controls[TORUS_R] = ModelerControl("Torus R", 0, 10, 0.1f, 0.6);
controls[TORUS_r] = ModelerControl("Torus r", 0, 10, 0.1f, 0.15);
controls[FLOOR_SIZE] = ModelerControl("Floor Size", 0, 8, 0.1f, 5.0f);
controls[FLOOR_DEPTH] = ModelerControl("Floor Depth", 0, 10, 1, 4);
controls[DETAIL_LEVEL] = ModelerControl("Detail Level", 1, 5, 1, 3);
// You should create a ParticleSystem object ps here and then
// call ModelerApplication::Instance()->SetParticleSystem(ps)
// to hook it up to the animator interface.
ModelerApplication::Instance()->Init(&createRobotArm, controls, NUMCONTROLS);
ParticleSystem *ps = new ParticleSystem();
ModelerApplication::Instance()->SetParticleSystem(ps);
Force* g = new Gravity((float)VAL(GRAVITY));
//Force* g = new Gravity(9.8f);
ps->addForce(g);
Wind *wind = new Wind();
wind->setDirection(Vec3f((float)-VAL(X_WIND) - 5.0f, (float)VAL(Y_WIND) - 5.0f, (float)VAL(Y_WIND) - 5.0f));
//wind->setDirection(Vec3f(-0.4, 0, 0.2));
wind->setMagnitube((float)VAL(WIND_MAGNITUDE));
//wind->setMagnitube(6.0);
ps->addForce(wind);
return ModelerApplication::Instance()->Run();
}