Beispiel #1
0
/*
****Test to check and make sure that all of the execptions in the Ionomodel
****class are thrown where and as they are expected to

**** Please note:  As of June 29,2006 I have not found a way to get the blankAlmanac
**** exception to throw the way I wanted it to.  I have set it to assert fail so I can
**** come back at a later date to fix it.
*/
void xIonoModel :: exceptionTest (void)
{
	//Default constructer for Almanac will give a blank almanac
	gpstk::EngAlmanac blankAlmanac;
	//Set DayTime to the current system time
	gpstk::CommonTime commonTime;
	//Use the default Geodetic constructer
	gpstk::Position rxgeo;
	//Set el and az to 0 for ease of testing
	double svel = 0;
	double svaz = 0;
	//Easy alpha and beta for Ionospheric testing
	double a[4] = {1.,2.,3.,4.};
	double b[4] = {4.,3.,2.,1.};
	gpstk::IonoModel Model(blankAlmanac);
	gpstk::IonoModel goodModel(a,b);

	try
	{
	CPPUNIT_ASSERT_THROW(blankAlmanac.getIon(a,b),gpstk::InvalidRequest);
	//Questioning why this isnt failing auto fail for now
	CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT_THROW(gpstk::IonoModel Model(blankAlmanac),gpstk::Exception));
	CPPUNIT_ASSERT_THROW(Model.getCorrection(commonTime,rxgeo,svel,svaz,Model.L1),gpstk::IonoModel::InvalidIonoModel);
	CPPUNIT_ASSERT_NO_THROW(goodModel.getCorrection(commonTime,rxgeo,svel,svaz,Model.L1));
	CPPUNIT_ASSERT_NO_THROW(goodModel.getCorrection(commonTime,rxgeo,svel,svaz,Model.L2));
	CPPUNIT_ASSERT_NO_THROW(goodModel.getCorrection(commonTime,rxgeo,72.,45.,Model.L1));
	}
	catch(gpstk::Exception& e)
	{
	}
}
Beispiel #2
0
Model ASTUtil::get_model(uint64_t fn, ModelGetter *model_getter)
{
    if(model_getter){
        JSONNode n = model_getter->operator()(fn);
        return Model(n);
    }
    return Model(JSONNode());
}
Beispiel #3
0
Model MRSFileLoader::createStaticModel( const char* filename ){
	ASSERT( mImpl && "Graphics::XFileLoader : This is empty Object" );
	mImpl->static_createModel( filename );
	Model::Impl* modelImpl = NEW Model::Impl( mImpl );
	modelImpl->release();
	return Model( modelImpl );
}
int main(int argc, char *argv[])
{
	std::string InputFile;
	double maxsize;
	
	po::options_description desc("Allowed options");
	desc.add_options()
			("help", "Help message.")
			("input", po::value<std::string>(&InputFile), "Set input file")
			//("output", po::value<std::string>(&OutputFile), "Set output file")
			//("x", po::value<double>(&X)->default_value(0.0), "Center X")
			//("y", po::value<double>(&Y)->default_value(0.0), "Center Y")
			//("z", po::value<double>(&Z)->default_value(0.0), "Center Z")
			("maxsize", po::value<double>(&maxsize), "Max size between clusters.")
			;

	po::variables_map vm;
	po::store(po::parse_command_line(argc, argv, desc), vm);
	po::notify(vm);
	
	if(vm.count("help"))
	{
		std::cout << desc << std::endl;
		return 1;
	}
	CheckRequiredArgs(vm);

	//create the model
	ModelFile Model(InputFile);

	TestAgglomerativeClusterData(Model);

	return 0;
}
Beispiel #5
0
Household_Model::Household_Model (int model) :
	PUMA_Data_Array ()
{
	Model (model);
	Location_Field (0);
	Total_Field (0);
}
Beispiel #6
0
void GameObject::Clear()
{
	mTransform = Transform();
	mModel = Model();
	mBoundingBox = BoundingBox();
	mRenderSettings = GameObjectRenderSettings();
}
Beispiel #7
0
Model getPlane(const std::vector<Texture>& textures, glm::vec3 ubasis, glm::vec3 vbasis, glm::vec2 dimensions, glm::vec2 textureOffset, glm::vec2 textureScale)
{
	float ltc = textureOffset.x;
	float rtc = textureOffset.x + textureScale.x;
	float btc = textureOffset.y;
	float ttc = textureOffset.y + textureScale.y;

	std::vector<Vertex> vertices(4);
	vertices[0].position = (-ubasis * dimensions.x - vbasis * dimensions.y) * 0.5f;
	vertices[0].texCoords = glm::vec2(ltc, ttc);
	vertices[1].position = (ubasis * dimensions.x - vbasis * dimensions.y) * 0.5f;
	vertices[1].texCoords = glm::vec2(rtc, ttc);
	vertices[2].position = (-ubasis * dimensions.x + vbasis * dimensions.y) * 0.5f;
	vertices[2].texCoords = glm::vec2(ltc, btc);
	vertices[3].position = (ubasis * dimensions.x + vbasis * dimensions.y) * 0.5f;
	vertices[3].texCoords = glm::vec2(rtc, btc);
	vertices[0].normal = vertices[1].normal = vertices[2].normal = vertices[3].normal = glm::cross(ubasis, vbasis);

	std::vector<unsigned> indices;
	indices.push_back(0);
	indices.push_back(1);
	indices.push_back(2);
	indices.push_back(1);
	indices.push_back(3);
	indices.push_back(2);

	Mesh mesh(vertices, indices);
	Material material;
	material.setTextures(textures);
	return Model(mesh, material);
}
Beispiel #8
0
void init(Renderer &gfx, Context &ctx)
{	
	vao.create();
	vao.bind();

	cube_buffer.create(Mesh::genUnitCube(false, true, true));
	cube = Model(cube_buffer);

	skybox_buffer.create(Mesh::genUnitCube(false, false, true));
	skybox = Model(skybox_buffer);

	mat_view = mat4(1.0f);
	mat_projection = glm::perspective(PI / 5.0f, ctx.getWidth() / (float)ctx.getHeight(), 0.05f, 15.0f);

	camera.reset(0.0f, 0.0f, vec3(0.0f, 0.2f, 1.0f));
}
Beispiel #9
0
  void ModelExplorer::loadFile(const QString &fileName)
  {
    mDlg->show();

    openstudio::model::OptionalModel optionalModel;

    // see what type of file we are opening based on extension
    openstudio::path path = openstudio::toPath(fileName.toStdString().c_str());
    if (openstudio::istringEqual("." + openstudio::modelFileExtension(), openstudio::toString(path.extension()))){
      QString text("Loading ");
      text += openstudio::modelFileExtension().c_str();
      text += " file";
      mProgressBarLbl->setText(text);
      OptionalIdfFile oIdfFile = IdfFile::load(path,mProgressBar);
      if(oIdfFile){
        optionalModel = Model(*oIdfFile);
      }
    }else if(openstudio::istringEqual(".idf", openstudio::toString(path.extension()))){
      mProgressBarLbl->setText("Loading IDF file");
      openstudio::OptionalIdfFile idfFile = openstudio::IdfFile::load(path,openstudio::IddFileType::EnergyPlus,mProgressBar);
      if(idfFile){
        /*
        mProgressBarLbl->setText("Creating workspace");
        openstudio::Workspace workspace(*idfFile,StrictnessLevel::None);
        // START DEBUG CODE
        openstudio::WorkspaceObjectVector wsObjects = workspace.objects();
        openstudio::WorkspaceObjectOrder order = workspace.order();
        BOOST_FOREACH(const openstudio::WorkspaceObject wso,wsObjects){
          OS_ASSERT(order.inOrder(wso.handle()));
        }
        // END DEBUG CODE
        openstudio::energyplus::ReverseTranslator2 reverseTranslator(workspace);
        mProgressBarLbl->setText("Creating workspace");
        optionalModel = reverseTranslator.convert();
        // BEGIN DEBUG CODE
        if(optionalModel){
          order = optionalModel->order();
          wsObjects = optionalModel->objects();
          BOOST_FOREACH(const openstudio::WorkspaceObject wso,wsObjects){
            OS_ASSERT(order.inOrder(wso.handle()));
          }
        }
        // END DEBUG CODE
        */
      }
    }

    mDlg->hide();

    if(!optionalModel){
      QMessageBox::critical(this, "Unable to obtain an OpenStudio Model", "Verify that your input file is the correct version.");
      return;
    }

    setModel(optionalModel.get());
    loadModel();
    expandAllNodes();
  }
Model Model::create(string path){

    ostringstream s4, s5;
    s4 << "INSERT INTO Model(directory) VALUES('" + path + ".txt');";
    QSqlQuery query4(QString(s4.str().c_str()));
    int idModel = query4.lastInsertId().toInt();

    cout << s4.str() << endl;

    string command = "bash createCSV.sh " + path + " > FaceRecognition/modelos.csv";
    cout << command << endl;
    system(command.c_str());

    vector<Mat> images;
    vector<int> labels;

    try{
        read_csv("FaceRecognition/modelos.csv", images, labels);
    }catch (cv::Exception& e) {
        cerr << "ERROR OPENING CSV FILE" << endl;
        exit(1);
    }

    s5 << "INSERT INTO ModelStudent("
          "id_model,"
          "id_student) VALUES";

    set<int> ids(labels.begin(), labels.end());
    map<int, int> pairs;

    for(auto it = ids.begin(); it != ids.end(); ++it){
        Alumno* a = Alumno::create("", string(path + "/" + to_string(*it)));
        pairs[(*it)] = a->getId();
        s5 << "(" << idModel << ", " << a->getId() << ")";
        if(next(it) == ids.end()) s5 << ";";
        else s5 << ", \n";
    }
    cout << s5.str() << endl;
    vector<int> newLabels;
    for(int i = 0; i < labels.size(); i++){
        newLabels.push_back(pairs[labels[i]]);
    }

    for(int i = 0; i < images.size(); i++){
        equalizeHist(images[i], images[i]);
        cv::resize(images[i], images[i], Size(48,48));
    }


    QSqlQuery query5(QString(s5.str().c_str()));

    Model model = Model(createEigenFaceRecognizer(0, 3000));
    model->train(images, newLabels);
    model->save(string(path + ".txt"));
    cout << "END" << endl;

    return model;
}
void Cube::Initialize()
{

	mSquare = Model();
	mSquare.VertexData.push_back(glm::vec3(-1.0f, -1.0f, 0.0f));
	mSquare.VertexData.push_back(glm::vec3(1.0f, -1.0f, 0.0f));
	mSquare.VertexData.push_back(glm::vec3(1.0f, 1.0f, 0.0f));
	mSquare.VertexData.push_back(glm::vec3(-1.0f, 1.0f, 0.0f));
	//we want a gray cube cube.
	mSquare.ColorData.push_back(glm::vec3(1.0f, 0.0f, 0.0f));
	mSquare.ColorData.push_back(glm::vec3(1.0f, 0.0f, 0.0f));
	mSquare.ColorData.push_back(glm::vec3(1.0f, 0.0f, 0.0f));
	mSquare.ColorData.push_back(glm::vec3(1.0f, 0.0f, 0.0f));
	//first.riangle.
	mSquare.IndicesData.push_back(0);
	mSquare.IndicesData.push_back(1);
	mSquare.IndicesData.push_back(3);
	//secon.triangle.
	mSquare.IndicesData.push_back(1);
	mSquare.IndicesData.push_back(2);
	mSquare.IndicesData.push_back(3);

	mSquare.UVData.push_back((glm::vec2(0.0f, 0.0f)));
	mSquare.UVData.push_back((glm::vec2(1.0f, 0.0f)));
	mSquare.UVData.push_back((glm::vec2(0.0f, 1.0f)));
	mSquare.UVData.push_back((glm::vec2(1.0f, 1.0f)));
	mSquare.Initialize();



	int numberOfFaces = 6;
	mFacesModelMatrices.resize(numberOfFaces);

	//bottom
	mFacesModelMatrices[0] = glm::translate(0.0f, -1.0f, 0.0f)*glm::rotate(90.0f, glm::vec3(1.0f, 0.0f, 0.0f));
	//top
	mFacesModelMatrices[1] = glm::translate(0.0f, 1.0f, 0.0f)*glm::rotate(90.0f, glm::vec3(1.0f, 0.0f, 0.0f));
	//front
	mFacesModelMatrices[2] = glm::translate(0.0f, 0.0f, 1.0f);
	//back
	mFacesModelMatrices[3] = glm::translate(0.0f, 0.0f, -1.0f);
	//left
	mFacesModelMatrices[4] = glm::translate(-1.0f, 0.0f, 0.0f)*glm::rotate(90.0f, glm::vec3(0.0f, 1.0f, 0.0f));
	//right
	mFacesModelMatrices[5] = glm::translate(1.0f, 0.0f, 0.0f)*glm::rotate(90.0f, glm::vec3(0.0f, 1.0f, 0.0f));

	//this transformation is applied on the whole cube!!!
	CubeModelMatrix = glm::scale(50.0f, 50.0f, 50.0f);


	skyboxTextures[0] = std::unique_ptr<Texture>(new Texture("down.jpg", 1));
	skyboxTextures[1] = std::unique_ptr<Texture>(new Texture("up.jpg", 1));
	skyboxTextures[2] = std::unique_ptr<Texture>(new Texture("front.jpg", 1));
	skyboxTextures[3] = std::unique_ptr<Texture>(new Texture("back.jpg", 1));
	skyboxTextures[4] = std::unique_ptr<Texture>(new Texture("left.jpg", 1));
	skyboxTextures[5] = std::unique_ptr<Texture>(new Texture("right.jpg", 1));
}
IterativeExtensions<span, Node, Edge, GraphDataVariant>::IterativeExtensions (
    const GraphTemplate<Node,Edge,GraphDataVariant>&        graph,
    TerminatorTemplate<Node,Edge,GraphDataVariant>&         terminator,
    TraversalKind       traversalKind,
    ExtendStopMode_e    whenToStop,
    SearchMode_e        searchMode,
    bool                dontOutputFirstNucl,
    int                 max_depth,
    int                 max_nodes
)
    : graph(graph), terminator(terminator),
      traversalKind(traversalKind),  when_to_stop_extending(whenToStop),
      searchMode(searchMode), dont_output_first_nucleotide(dontOutputFirstNucl),
      max_depth(max_depth), max_nodes(max_nodes)
{
    model         = Model (graph.getKmerSize()  );
    modelMinusOne = Model (graph.getKmerSize()-1);
}
Beispiel #13
0
			Model fit(const vector<ofVec2f> & data, int order) {
				vector<float> x(data.size()), y(data.size());
				for (int i = 0; i < data.size(); i++) {
					x[i] = data[i].x;
					y[i] = data[i].y;
				}

				return Model({mathalgo::polyfit<float>(x, y, order)});
			}
Beispiel #14
0
Model getDebugBoxMesh(const glm::vec3& halfExtents)
{
	static unsigned topRightFronti = 0;
	static unsigned topLeftFronti = 1;
	static unsigned topRightBacki = 2;
	static unsigned topLeftBacki = 3;
	static unsigned botRightFronti = 4;
	static unsigned botLeftFronti = 5;
	static unsigned botRightBacki = 6;
	static unsigned botLeftBacki = 7;

	// We're not expecting this to be lit nor textured, so ignore normal and texCoord
	std::vector<Vertex> vertices(8);
	vertices[topRightFronti].position = glm::vec3(halfExtents.x, halfExtents.y, halfExtents.z);
	vertices[topLeftFronti].position = glm::vec3(-halfExtents.x, halfExtents.y, halfExtents.z);
	vertices[topRightBacki].position = glm::vec3(halfExtents.x, halfExtents.y, -halfExtents.z);
	vertices[topLeftBacki].position = glm::vec3(-halfExtents.x, halfExtents.y, -halfExtents.z);
	vertices[botRightFronti].position = glm::vec3(halfExtents.x, -halfExtents.y, halfExtents.z);
	vertices[botLeftFronti].position = glm::vec3(-halfExtents.x, -halfExtents.y, halfExtents.z);
	vertices[botRightBacki].position = glm::vec3(halfExtents.x, -halfExtents.y, -halfExtents.z);
	vertices[botLeftBacki].position = glm::vec3(-halfExtents.x, -halfExtents.y, -halfExtents.z);

	std::vector<unsigned> indices;
	// Top face
	indices.push_back(topLeftFronti);
	indices.push_back(topRightFronti);
	indices.push_back(topRightFronti);
	indices.push_back(topRightBacki);
	indices.push_back(topRightBacki);
	indices.push_back(topLeftBacki);
	indices.push_back(topLeftBacki);
	indices.push_back(topLeftFronti);
	// Bottom face
	indices.push_back(botLeftFronti);
	indices.push_back(botRightFronti);
	indices.push_back(botRightFronti);
	indices.push_back(botRightBacki);
	indices.push_back(botRightBacki);
	indices.push_back(botLeftBacki);
	indices.push_back(botLeftBacki);
	indices.push_back(botLeftFronti);
	// Connecting bars
	indices.push_back(topLeftFronti);
	indices.push_back(botLeftFronti);
	indices.push_back(topRightFronti);
	indices.push_back(botRightFronti);
	indices.push_back(topLeftBacki);
	indices.push_back(botLeftBacki);
	indices.push_back(topRightBacki);
	indices.push_back(botRightBacki);

	Mesh mesh(vertices, indices);
	Material material;
	material.drawType = MaterialDrawType_Lines;
	return Model(mesh, material);
}
// ---------------------------------------------------------------------------
// CAppMngr2ListContainer::LoadIconsL()
// ---------------------------------------------------------------------------
//
void CAppMngr2ListContainer::LoadIconsL()
    {
    CAknIconArray* iconArray = new ( ELeave ) CAknIconArray( KGranularity );
    CleanupStack::PushL( iconArray );
    Model().LoadIconsL( *iconArray );
    delete iListBox->ItemDrawer()->ColumnData()->IconArray();
    iListBox->ItemDrawer()->ColumnData()->SetIconArray( iconArray );
    CleanupStack::Pop( iconArray );
    iItemSpecificIcons = 0;
    }
Beispiel #16
0
void TabPanel::onCreate(const TabPanel * Id)
{
	Inherited::onCreate(Id);

    if(Id != NULL)
    {
        DefaultSingleSelectionModelUnrecPtr Model(DefaultSingleSelectionModel::create());
        setSelectionModel(Model);
    }
}
Model* addModel(const std::string& name)
{
    models.push_back(Model());

    auto mdl = &(models.back());
    mdl->name = name;

    std::cout << "Press " << models.size() << " to show the " << name << std::endl;

    return mdl;
}
// ---------------------------------------------------------------------------
// CAppMngr2ListContainer::HandleGenericCommandL()
// ---------------------------------------------------------------------------
//
void CAppMngr2ListContainer::HandleGenericCommandL( TInt aCommand )
    {
    if( !IsListEmpty() )
        {
        CAppMngr2InfoBase& currentItem = CurrentItem();
        if( currentItem.SupportsGenericCommand( aCommand ) )
            {
            Model().HandleCommandL( currentItem, aCommand );
            }
        }
    }
void CContextMediaBox::CreateItemDrawerL(void)
{
	CALLSTACKITEM_N(_CL("CContextMediaBox"), _CL("CreateItemDrawerL"));

	itemd=CFormattedCellListBoxData::NewL();
	CleanupStack::PushL(itemd);

	iItemDrawer=new (ELeave) CContextMediaBoxDrawer(Model(), LatinPlain12(), itemd, iPostArray,
													iStandAlone);
	
	CleanupStack::Pop();	
}
Beispiel #20
0
    Model &Backend::getModel(std::string name)
    {
        if (!models.count(name)) {
            if (modules.count(name)) {
                Model model = loadModelSTL_string(getModule(name)->openscad("stl"));
                models[name] = model;
            } else {
                models[name] = Model();
            }
        }

        return models[name];
    }
Beispiel #21
0
	void Spawn( void )
	{
		Precache();

		pev->movetype = MOVETYPE_PHYSIC;
		pev->solid = SolidType();
		pev->owner = ENT( pev ); // g-cont. i'm forget why needs this stuff :)

		UTIL_SetOrigin( this, pev->origin );
		UTIL_SetModel( ENT( pev ), pev->model, (char *)Model() );

		SetObjectClass( ED_RIGIDBODY );
	}
Beispiel #22
0
Model Model::createGround(Shader* shader, const int meshCount, const GLfloat maxHillHeight) {
    std::vector<Vertex> groundVertices;
    std::vector<GLuint> groundIndices;
    
    float from = -1.0f;
    float to = 1.0f;
    float diff = to - from;
    for (int i = 0; i <= meshCount; ++i) {
        for (int j = 0; j <= meshCount; ++j) {
            float x = (i * diff / meshCount) + from;
            float z = (j * diff / meshCount) + from;
            float y = (float) rand() / (float) RAND_MAX;
            
            Vertex v;
            v.position = glm::vec3(x, y * maxHillHeight, z);
            groundVertices.push_back(v);
        }
    }
    
    for (int i = 0; i < meshCount; ++i) {
        for (int j = 0; j < meshCount; ++j) {
            groundIndices.push_back((i) * (meshCount + 1) + j);
            groundIndices.push_back((i + 1) * (meshCount + 1) + j);
            groundIndices.push_back((i) * (meshCount + 1) + j + 1);
            
            groundIndices.push_back((i) * (meshCount + 1) + j + 1);
            groundIndices.push_back((i + 1) * (meshCount + 1) + j);
            groundIndices.push_back((i + 1) * (meshCount + 1) + j + 1);
        }
    }
    
    for (int i = 0; i < groundIndices.size(); i += 3) {
        glm::vec3 v[] = { groundVertices[groundIndices[i]].position, groundVertices[groundIndices[i+1]].position,
                           groundVertices[groundIndices[i+2]].position };
        glm::vec3 norm = glm::cross(v[2] - v[0], v[1] - v[0]);
        
        groundVertices[groundIndices[i]].normal += norm;
        groundVertices[groundIndices[i+1]].normal += norm;
        groundVertices[groundIndices[i+2]].normal += norm;
        
    }
    
    for (int i = 0; i < groundVertices.size(); ++i) {
        groundVertices[i].normal = glm::normalize(groundVertices[i].normal);
    }
    
    std::vector<Mesh> meshes;
    meshes.push_back(Mesh(groundVertices, groundIndices));
    return Model(meshes, glm::vec3(0.1f, 0.8f, 0.1f), shader);
}
Beispiel #23
0
PDBResidue *PDBChain::
InsertCopy(PDBResidue *r)
{
  // Insert copy of residue into this chain
  PDBResidue *residue = new PDBResidue(Model(), this, r->Name(), r->Sequence(), r->InsertionCode());
  assert(residue);

  // Insert copy of all r's atoms
  for (int i = 0; i < r->NAtoms(); i++) 
    residue->InsertCopy(r->Atom(i));

  // Return residue
  return residue;
}
Beispiel #24
0
int ColInfo::add_joint_pair(Joint* j1, Joint* j2, SceneGraph* sg)
{
    if(Pair(j1, j2)) return 0;
    ColModel* m1, *m2;
    m1 = Model(j1);
    if(!m1)
    {
        m1 = new ColModel(j1, sg);
        add_model(m1);
    }
    m2 = Model(j2);
    if(!m2)
    {
        m2 = new ColModel(j2, sg);
        add_model(m2);
    }
    if(m1->n_triangle == 0 || m2->n_triangle == 0) return -1;
    if( (j1->parent == j2 && j1->n_dof == 0) || (j2->parent == j1 && j2->n_dof == 0) )
        return 0;
    cerr << "add joint pair: " << j1->name << ", " << j2->name << endl;
    ColPair* p = new ColPair(m1, m2);
    add_pair(p);
    return 0;
}
Beispiel #25
0
EXPORT_C void CEikSettingsListBox::CreateItemDrawerL()
    {
    _AKNTRACE_FUNC_ENTER;
    CSettingsListBoxData* cellData=CSettingsListBoxData::NewL();
    CleanupStack::PushL( cellData );

    if ( FeatureManager::FeatureSupported( KFeatureIdSettingsProtection ) )
        {
        iItemDrawer = SettingsProtListBoxItemDrawerFactory::
            CreateSettingsProtListBoxItemDrawerL(
                Model(),
                CEikonEnv::Static()->NormalFont(),
                cellData,
                this );
        }
    else
        {
        iItemDrawer = new ( ELeave ) CSettingsListBoxItemDrawer(
            Model(), CEikonEnv::Static()->NormalFont(), cellData );
        }

    CleanupStack::Pop();
    _AKNTRACE_FUNC_EXIT;
    }
Beispiel #26
0
Model Exword::GetModel()
{
    Model modelInfo;
    exword_model_t model;
    memset(&model, 0, sizeof(exword_model_t));
    if (IsConnected()) {
        if (exword_get_model(m_device, &model) == EXWORD_SUCCESS) {
            modelInfo = ModelDatabase::Get()->Lookup(wxString::FromAscii(model.model),
                                                     wxString::FromAscii(model.sub_model),
                                                     wxString::FromAscii(model.ext_model));
            if (modelInfo.GetSeries() == 0) {
                if ((model.capabilities & CAP_F) &&
                    (model.capabilities & CAP_C)) {
                    modelInfo = Model(5);
                } else if (model.capabilities & CAP_P) {
                    modelInfo = Model(4);
                } else {
                    modelInfo = Model(3);
                }
            }
        }
    }
    return modelInfo;
}
Beispiel #27
0
bool Scene::ObjectAdd(
	std::string objectName,
	const char* ply_filepath,
	const char* texturepath,
	MODEL_TYPE modelType,
	glm::vec3 poz,
	glm::vec3 size)
{
	for (unsigned int i = 0; i < models.size(); i++){
		if (models.at(i).Name() == objectName)
			return false;
	}
	models.push_back(Model(objectName, ply_filepath, texturepath, modelType, poz, size));
	return true;
}
Beispiel #28
0
Model Resource::model() const
{
    if (!d) {
        return Model();
    }

    const QSharedPointer<Model::ModelPrivate> mp = d->model.toStrongRef();

    Model m;

    if (mp) {
        m.d = mp;
    }

    return m;
}
Beispiel #29
0
ColModel* ColInfo::AddModel(Joint* jref, SceneGraph* sg)
{
    ColModel* ret = Model(jref);
    if(!ret)
    {
        ret = new ColModel(jref, sg);
        if(ret->n_triangle > 0)
            add_model(ret);
        else
        {
            delete ret;
            ret = 0;
        }
    }
    return ret;
}
Beispiel #30
0
std::shared_ptr<PMX::Model> ModelManager::loadModel(const std::wstring &Name, std::shared_ptr<Physics::Environment> Physics)
{
	auto Path = KnownModels.find(Name);

	if (Path == KnownModels.end())
		return nullptr;

	std::shared_ptr<PMX::Model> Model(new PMX::Model);
	assert(Model);
	Model->SetPhysics(Physics);

	if (!Model->LoadModel(Path->second.wstring()))
		return nullptr;

	return Model;
}