//----------------------------------------------------------------------------
void SimplePendulumFriction::CreateScene ()
{
	mScene = new0 Node();
	mWireState = new0 WireState();
	mRenderer->SetOverrideWireState(mWireState);

	mScene->AttachChild(CreateFloor());
	mScene->AttachChild(CreatePendulum());
}
//----------------------------------------------------------------------------
void FoucaultPendulum::CreateScene ()
{
    mScene = new0 Node();
    mScene->AttachChild(CreateFloor());
    mScene->AttachChild(CreatePath());
    mScene->AttachChild(CreatePendulum());
    mWireState = new0 WireState();
    mRenderer->SetOverrideWireState(mWireState);
}
Esempio n. 3
0
//----------------------------------------------------------------------------
void BouncingBall::CreateScene ()
{
    mScene = new0 Node();
    mWireState = new0 WireState();
    mRenderer->SetOverrideWireState(mWireState);

    CreateBall();
    CreateFloor();
    CreateWall();
    mScene->AttachChild(mFloor);
    mScene->AttachChild(mWall);

    // The floor reflects an image of the ball.
    mPREffect = new0 PlanarReflectionEffect(1);
    mPREffect->SetPlane(0, mFloor);
    mPREffect->SetReflectance(0, 0.2f);
}
Esempio n. 4
0
//----------------------------------------------------------------------------
void BouncingSpheres::CreateScene ()
{
    CreateBalls();
    CreateFloor();
    CreateBackWall();
    CreateSideWall1();
    CreateSideWall2();

    // ** layout of scene graph **
    // scene
    //     room
    //         backwall
    //         floor
    //         sidewall1
    //         sidewall2
    //     balls

    mScene = new0 Node();
    mWireState = new0 WireState();
    mRenderer->SetOverrideWireState(mWireState);

    Node* room = new0 Node();
    room->AttachChild(mFloor);
    room->AttachChild(mSideWall1);
    room->AttachChild(mSideWall2);
    room->AttachChild(mBackWall);
    mScene->AttachChild(room);

    Node* ballRoot = new0 Node();
    int i;
    for (i = 0; i < NUM_BALLS; ++i)
    {
        ballRoot->AttachChild(mBallNodes[i]);
    }
    mScene->AttachChild(ballRoot);

    // The balls are constrained to bounce around in a rectangular solid
    // region.  The six defining planes are defined to be immovable rigid
    // bodies.  The boundaries are parallel to coordinate axes and pass
    // through the points indicated by the value other than +-100.  That is,
    // the back wall is at x = 1, the left wall is at y = 2, the floor is at
    // z = 1, the right wall is at y = 15, the ceiling is at z = 17, and the
    // front wall is at x = 9.  The ceiling and front wall are invisible
    // objects (not rendered), but you will see balls bouncing against it
    // and reflecting away from it towards the back wall.
    mBoundaryLocations[0] = Vector3f(1.0f, -100.0f, -100.0f);
    mBoundaryNormals[0] = Vector3f(1.0f, 0.0f, 0.0f);
    mBoundaryLocations[1] = Vector3f(-100.0f, 2.0f, -100.0f);
    mBoundaryNormals[1] = Vector3f(0.0f, 1.0f, 0.0f);
    mBoundaryLocations[2] = Vector3f(-100.0f, -100.0f, 1.0f);
    mBoundaryNormals[2] = Vector3f(0.0f, 0.0f, 1.0f);
    mBoundaryLocations[3] = Vector3f(100.0f, 15.0f, 100.0f);
    mBoundaryNormals[3] = Vector3f(0.0f, -1.0f, 0.0f);
    mBoundaryLocations[4] = Vector3f(100.0f, 100.0f, 17.0f);
    mBoundaryNormals[4] = Vector3f(0.0f, 0.0f, -1.0f);
    mBoundaryLocations[5] = Vector3f(8.0f, 100.0f, 100.0f);
    mBoundaryNormals[5] = Vector3f(-1.0f, 0.0f, 0.0f);
    for (i = 0; i < 6; ++i)
    {
        mBoundaries[i].SetMass(0.0f);
        mBoundaries[i].SetPosition(mBoundaryLocations[i]);
    }
}