Пример #1
0
static model_t *createModel(void) {
	model_t *m = malloc( sizeof( model_t ) );

	if(m != NULL) {
		m->b = createDude(dude_b, sizeof(dude_b));
		m->b_pos.x = 0.0f; m->b_pos.y = 0.0f; m->b_pos.z = 0.0f;

		m->b2 = createDude(dude_b2, sizeof(dude_b2));
		m->b2_pos.x = 0.0f; m->b2_pos.y = 10.0f; m->b2_pos.z = 0.0f;

		m->gir = createDude(dude_gir, sizeof(dude_gir));
		m->gir_pos.x = 0.0f; m->gir_pos.y = 0.0f; m->gir_pos.z = 10.0f;

		m->test = createDude(dude_test, sizeof(dude_test));
		m->test_pos.x = 10.0f; m->test_pos.y = 0.0f; m->test_pos.z = 0.0f;

		m->doob = createDude(dude_doob, sizeof(dude_doob));
		m->doob_pos.x = 0.0f; m->doob_pos.y = 0.0f; m->doob_pos.z = 20.0f;

		m->peter = createDude(petercrumb, sizeof(petercrumb));
		m->peter_pos.x = -20.0f; m->peter_pos.y = 40.0f; m->peter_pos.z = 50.0f;

		if((m->b == NULL) || (m->b2 == NULL) ||
		   (m->gir == NULL) || (m->test == NULL) ||
		   (m->doob == NULL)) {
			destroyModel(m);
			m = NULL;
		}
	}

	return m;
}
Пример #2
0
Corpus::~Corpus()
{
  if (SceneNode) {
    destroyModel(SceneNode);
  }

  Game::Corpus->deregisterObject(this);
}
Пример #3
0
bool Projectile::update(const Real a_dt)
{
    if (GracePeriod < 0) {
        Bullet->CollisionType = collision_type_impact;
    }

    // kill after range exceeded
    if (Lifetime < 0) {
        if (!Exploading) {
            explode();
        }
    }
    if (Exploading) {
        // does the projectile explode causing splash damage
        if (OwnerWeapon->weapon_design.splash_range > 0) {
            // start splash expansion and degradation
            Real expansion = a_dt * OwnerWeapon->weapon_design.splash_velocity;
            // expand the bounding sphere
            Bullet->BoundingSphere.Radius += expansion;

            // as the ball expands make hp (density) smaller,
            // hp gets below zero if the sphere is larger than max radius of the explosion
            Lifetime = 1 - (Bullet->BoundingSphere.Radius / OwnerWeapon->weapon_design.splash_range);

            // how much of the expolsion damage to apply
            Real coverage = (expansion / OwnerWeapon->weapon_design.splash_range);

            Bullet->BallisticDmg = OwnerWeapon->weapon_design.BallisticDmg
                                   * OwnerWeapon->weapon_design.splash_velocity * coverage;
            Bullet->EnergyDmg = OwnerWeapon->weapon_design.EnergyDmg * coverage;
            Bullet->HeatDmg = OwnerWeapon->weapon_design.HeatDmg * coverage;

        } else { // no splash damage
            Lifetime = -1; // kill instantly
        }
    }

    // if out of bounds destroy
    if (Lifetime < 0) {
        OwnerWeapon = NULL;
        Game::Corpus->deregisterObject(Bullet);
        destroyModel(Bullet->SceneNode);
        Bullet->SceneNode = NULL;
        return false;
    }

    Vector3 move = Bullet->Velocity * a_dt;
    // count up the length into lifetime
    Lifetime -= move.length();

    return true;
}
Пример #4
0
ClassTreeView::~ClassTreeView()
{
    destroyModel();

    delete actionAddClass;
    delete actionRemoveClass;
    delete actionShowAttr;
    delete actionShowComp;
    delete actionShowFilter;
    delete actionSeparator;
    delete actionShowUnit;
    delete contextMenu;
}
Пример #5
0
void ClassTreeView::setModel(QAbstractItemModel *model)
{
    destroyModel();
    classFilterModel = new TreeFilterProxyModel();
    classFilterModel->setSourceModel(model);
    classFilterModel->setDynamicSortFilter(true);
    classFilterModel->sort(0);

    classFilterModel->addVisibleTag(DBCLASSXML::CLASS);
    classFilterModel->addVisibleTag(DBCLASSLISTXML::CLASSLIST);
    classFilterModel->addVisibleTag(DBQUANTITYGROUPXML::QUANTITYGROUP);
    classFilterModel->addVisibleTag(DBQUANTITYXML::QUANTITY);
    classFilterModel->addVisibleTag(DBQUANTITYLISTXML::QUANTITYLIST);
    classFilterModel->addVisibleTag(DBLOVLISTXML::LOVLIST);
    classFilterModel->addVisibleTag(DBLOVXML::LOV);
    classFilterModel->addVisibleTag(DBNUMERATORLISTXML::NUMERATORLIST);
    classFilterModel->addVisibleTag(DBNUMERATORXML::NUMERATOR);
    classFilterModel->addVisibleTag(DBREFLISTXML::REFLIST);
    classFilterModel->addVisibleTag(DBREFGROUPXML::REFGROUP);
    classFilterModel->addVisibleTag(DBREFXML::REF);
    classFilterModel->addVisibleTag(DBROLELISTXML::ROLELIST);
    classFilterModel->addVisibleTag(DBROLEXML::ROLE);
    classFilterModel->addVisibleTag(DBMODELXML::MODEL);
    classFilterModel->addVisibleTag(DBROOTXML::ROOT);

    QRegExp regex = classFilterModel->filterRegExp();
    classFilterModel->setFilterRegExp(regex);

    connect(model, &QAbstractItemModel::destroyed,
            this, &ClassTreeView::destroyModel);

    connect(lineEditFiler, &QLineEdit::textChanged,
            classFilterModel,
            static_cast<void (TreeFilterProxyModel::*)(const QString&)>
            (&TreeFilterProxyModel::setFilterRegExp));

    connect(lineEditFiler, &QLineEdit::textChanged,
            treeView, &QTreeView::expandAll);

    treeView->setModel(classFilterModel);

    for (qint32 i = model->columnCount() - 1; i > 0; --i)
        treeView->hideColumn(i);

    actionShowAttr->setChecked(false);
    actionShowComp->setChecked(false);
    actionShowFilter->setChecked(false);
    actionShowUnit->setChecked(false);
}
Пример #6
0
    //-----------------------------------------------------------------------
    void ModelObject::destroyRenderInstance(void)
    {
        if (mModel)
        {
            destroyModel();
        }

        if (mProxy)
        {
            delete mProxy;
            mProxy = NULL;
        }

        PlacementObject::destroyRenderInstance();
    }
Пример #7
0
void Factory::destroyModel(Ogre::SceneNode* sceneNode) {
	Ogre::SceneNode::ObjectIterator it = sceneNode->getAttachedObjectIterator();
    while (it.hasMoreElements()) {
        Ogre::MovableObject* movableEntity = static_cast<Ogre::MovableObject*>(it.getNext());
        sceneNode->getCreator()->destroyMovableObject(movableEntity);
    }

    //destroy children if any
    Ogre::SceneNode::ChildNodeIterator it2 = sceneNode->getChildIterator();
    while (it2.hasMoreElements()) {
        Ogre::SceneNode* childNode = static_cast<Ogre::SceneNode*>(it2.getNext());
        destroyModel(childNode);
    }

    //at last remove the scene node
    Game::scene->destroySceneNode(sceneNode);
}
Пример #8
0
    //-----------------------------------------------------------------------
    void ModelObject::setModelName(const String& modelName)
    {
        if (mModelName != modelName)
        {
            if (mModel)
            {
                destroyModel();
            }

            mModelName = modelName;

            if (mProxy && !mModelName.empty())
            {
                createModel();
            }
        }
    }
void ControlleurNouveau::exec()
{
    int ret = getVue()->exec();

    if(ret == QDialog::Accepted)
    {
        emit s_enable(true);

        int limite_pts;
        bool limite_nb;
        QString jeux, armee, liste;
        getVue()->get(limite_nb, limite_pts, jeux, armee, liste);


        if(hasModel())
        {
            destroyModel();
        }

        getModel()->setliste(new Codex);
        getModel()->getListe()->setNomListe(liste);
        getModel()->setNomJeux(jeux);

        jeux.replace(" ", "_");
        armee.replace(" ", "_");

        ControlleurChargement c;
        if(c.chargerNouveau(armee, jeux))
        {

            if(!limite_nb)
            {
                for(QMap<QString, int>::iterator it = getModel()->getLimite().begin(); it != getModel()->getLimite().end(); it++)
                {
                    it.value() = 0;
                }
            }
            emit s_max(limite_pts);
        }
    }
}
Пример #10
0
int main(int argc, char * argv[])
{
	window_system_initialise(argc, &argv);

	model = createModel();
	if(model == NULL) {
		printf("Failed to create model :(\n");
		exit(1);
	}

        window_system_set_redraw_callback(display);
        window_system_set_resize_callback(reshape);
        window_system_set_rotate_callback(ROTATION_SPEED_MS, rotate);

	glEnable(GL_DEPTH_TEST);
	glFrontFace(GL_CCW);
	glCullFace(GL_BACK);
	glEnable(GL_CULL_FACE);

	glEnableClientState(GL_VERTEX_ARRAY);
	glEnableClientState(GL_COLOR_ARRAY);
	glEnableClientState(GL_NORMAL_ARRAY);

	glEnable(GL_LIGHTING);
	glEnable(GL_COLOR_MATERIAL);
	glShadeModel(GL_SMOOTH);

	light_0_enable();

	window_system_start_main_loop();

	glDisableClientState(GL_NORMAL_ARRAY);
	glDisableClientState(GL_COLOR_ARRAY);
	glDisableClientState(GL_VERTEX_ARRAY);
	destroyModel(model);

	return 0;
}
Пример #11
0
int main(int argc, char * argv[])
{
#if USE_GTK == 1
	GtkWidget *window;
	GtkWidget *drawing_area;
	GdkGLConfig *gl_config;

	gtk_init(&argc, &argv);
	gtk_gl_init(&argc, &argv);
#else
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_SINGLE | GLUT_DEPTH);
#endif
	model = createModel();
	if(model == NULL) {
		printf("Failed to create model :(\n");
		exit(1);
	}

#if USE_GTK == 1
	window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	gtk_window_set_default_size (GTK_WINDOW (window), DEFAULT_WIN_WIDTH, DEFAULT_WIN_HEIGHT);
	drawing_area = gtk_drawing_area_new();
	gtk_container_add( GTK_CONTAINER( window ), drawing_area );
	g_signal_connect_swapped (window, "destroy",
	                          G_CALLBACK (gtk_main_quit), NULL);
	gtk_widget_set_events(drawing_area, GDK_EXPOSURE_MASK);

	gl_config = gdk_gl_config_new_by_mode(GDK_GL_MODE_RGB |
					      GDK_GL_MODE_DEPTH |
					      GDK_GL_MODE_DOUBLE);

	if (!gl_config) {
		printf("Messed up the config :(\n");
		exit(1);
	}

	if (!gtk_widget_set_gl_capability(drawing_area, gl_config, NULL, TRUE,
                                          GDK_GL_RGBA_TYPE)) {
		printf("Couldn't get capabilities we needed :(\n");
		exit(1);
	}

	g_signal_connect(drawing_area, "configure-event",
                         G_CALLBACK(configure), NULL);
	g_signal_connect(drawing_area, "expose-event",
                         G_CALLBACK(expose), NULL);
	gtk_widget_show_all(window);

	/* turned rotation off */
	/*g_timeout_add(ROTATION_SPEED_MS, rotate_callback, drawing_area);*/
#else
	glutInitWindowSize(DEFAULT_WIN_WIDTH, DEFAULT_WIN_HEIGHT);
	glutInitWindowPosition(100, 100);
	glutCreateWindow("Simple 3D Collision Detection");
	glutDisplayFunc(display);
	glutReshapeFunc(reshape);
	/* turned rotation off */
	/*glutTimerFunc(ROTATION_SPEED_MS, rotate_callback, 0 );*/
	glutTimerFunc(1000/MAX_MOVEMENT_SPEED, move_dude_callback, 0);
#endif

	glEnable(GL_DEPTH_TEST);
	glFrontFace(GL_CCW);
	glCullFace(GL_BACK);
	glEnable(GL_CULL_FACE);
	glEnableClientState(GL_VERTEX_ARRAY);
	glEnableClientState(GL_COLOR_ARRAY);
	glEnableClientState(GL_NORMAL_ARRAY);

	glEnable(GL_LIGHTING);
	glEnable(GL_COLOR_MATERIAL);
	glShadeModel(GL_SMOOTH);

	light_0_enable();

#if USE_GTK == 1
	gtk_main();
#else
	glutMainLoop();
#endif
	glDisableClientState(GL_NORMAL_ARRAY);
	glDisableClientState(GL_COLOR_ARRAY);
	glDisableClientState(GL_VERTEX_ARRAY);
	destroyModel(model);

	return 0;
}
Пример #12
0
ColorizerRow::~ColorizerRow ()
{
	destroyModel();
	doneUI();
}
Пример #13
0
FilterFileLine::~FilterFileLine ()
{
	destroyModel();
	doneUI();
}
Пример #14
0
void FilterFileLine::applyConfig ()
{
	FilterBase::applyConfig();
	destroyModel();
	setupModel();
}
Пример #15
0
FilterTid::~FilterTid ()
{
	destroyModel();
	doneUI();
}
Пример #16
0
FilterLvl::~FilterLvl ()
{
	destroyModel();
	doneUI();
}
Пример #17
0
FilterScript::~FilterScript ()
{
	destroyModel();
	doneUI();
}
Пример #18
0
FilterTime::~FilterTime ()
{
	destroyModel();
	doneUI();
}