Exemplo n.º 1
0
Atom_Unbound_Virt::Atom_Unbound_Virt(const Vector3& position) : 
    Atom::Atom(100, position)
{
    //Création de l'apparence graphique de l'atome
    initNode(
        Geometry::sphere(3),
        ColourValue(0.5, 1.0, 1.0, 1.0)
    );
}
Exemplo n.º 2
0
Atom_Apply::Atom_Apply(const Vector3& position) : 
    Atom::Atom(200, position)
{
    //Création de l'apparence graphique de l'atome
    initNode(
        Geometry::sphere(10), 
        ColourValue(1.0, 0.0, 0.0, 1.0)
    );
}
Exemplo n.º 3
0
Atom_Term::Atom_Term(const Vector3& position, int value) : 
    Atom::Atom(75, position),
    _value(value)
{
    assert(value >=0 && value <= 1);
    Real color = 0.2+8.0*value/10.0;

    //Création de l'apparence graphique de l'atome
    initNode(
        Geometry::sphere(10),
        ColourValue(color, color, color, 1.0)
    );
}
Exemplo n.º 4
0
void Application::createCamera()
{
    _camera = _scene->createCamera("camera");
    _camera->setPosition(Vector3(1000,1000,1000));
    _camera->lookAt(Vector3(0,-1000,0));
    _camera->setNearClipDistance(1);
    _camera->setFarClipDistance(100000);

    Viewport* vp = _window->addViewport(_camera);
    _camera->setAspectRatio(Real(vp->getActualWidth())/Real(vp->getActualHeight()));
    //_camera->setPolygonMode(Ogre::PM_WIREFRAME);
    vp->setBackgroundColour(ColourValue(0,0,0));
}
Exemplo n.º 5
0
void Application::initSimulation()
{
    //Initialisation le générateur aléatoire
    //(debug)
    int seed = (int)Math::RangeRandom(20, 10000000);
    std::cout << "===>" << (int)seed << std::endl;
    //int seed = 6486951;//7264745 8983653;
    //int seed = 7264745;
    //int seed = 8983653;
    //int seed = 9765800;
    srand(seed);

    _scene->setAmbientLight(ColourValue(0.1, 0.1, 0.1));
    Ogre::Light *light1 = _scene->createLight();
    light1->setDiffuseColour(1.0, 1.0, 1.0);
    light1->setSpecularColour(1.0, 1.0, 1.0);
    light1->setPosition(-100, 200, 100);

    Entity* ent = _scene->createEntity("ogrehead.mesh");
    SceneNode* node = _scene->getRootSceneNode()->createChildSceneNode();
    node->attachObject(ent);

    for (int i=0;i<2000;i++) {
        Vector3 position = Vector3(
            Math::RangeRandom(-1500, 1500),
            Math::RangeRandom(-1500, 1500),
            Math::RangeRandom(-1500, 1500));
        Atom* a;
        Real r = Math::RangeRandom(0,100);
        if (r>=90) a = new Atom_Lambda(position);
        else if (r>=80) a = new Atom_Lambda_Virt(position);
        else if (r>=70) a = new Atom_Apply(position);
        else if (r>=60) a = new Atom_Apply_Virt(position);
        else if (r>=50) a = new Atom_Association(position);
        else if (r>=40) a = new Atom_Association_Virt(position);
        else if (r>=35) a = new Atom_Bound(position);
        else if (r>=30) a = new Atom_Bound_Virt(position);
        else if (r>=25) a = new Atom_Unbound(position);
        else if (r>=20) a = new Atom_Unbound_Virt(position);
        else if (r>=10) a = new Atom_Term(
            position, 
            (int)Math::RangeRandom(0.0, 2.0)
        );
        else if (r>=0) a = new Atom_Term_Virt(
            position, 
            (int)Math::RangeRandom(0.0, 2.0)
        );
        if (!_positionResolver->checkCollisionAtoms(
            a->getPosition(), a->getRadius())) 
        {
            _atoms->add(a);
            _scene->_updateSceneGraph(0);
        } else {
            delete a;
        }
    }
    
    /*
    _atoms->createBond(
        _atoms->get(0),
        _atoms->get(1),
        150
    );
    _atoms->createBond(
        _atoms->get(1),
        _atoms->get(2),
        150
    );
    _atoms->createBond(
        _atoms->get(2),
        _atoms->get(3),
        150
    );
    _atoms->createBond(
        _atoms->get(3),
        _atoms->get(0),
        150
    );
    _atoms->get(0)->transfertBonds(_atoms->get(1));
    _atoms->get(1)->transfertBonds(_atoms->get(2));

    Graph* g = 0;
    for (size_t i=0;i<_atoms->getSize();i++) {
        if (_atoms->get(i)->isType<Atom_Lambda>()) {
            g = new Graph();
            g->build(_atoms->get(i));
            break;
        }
    }
    TransformLambda t = TransformLambda(*g);
    std::cout << t.isValid() << std::endl;
    if (t.isValid()) {
        while(t.doTransformStep());
    }
    */
}