当前位置: 首页>>代码示例>>C++>>正文


C++ ModelLoader类代码示例

本文整理汇总了C++中ModelLoader的典型用法代码示例。如果您正苦于以下问题:C++ ModelLoader类的具体用法?C++ ModelLoader怎么用?C++ ModelLoader使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ModelLoader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: solidShapesFromURDFString

bool solidShapesFromURDFString(const std::string & urdf_string,
                               const std::string & urdf_filename,
                               const Model & model,
                               const std::string urdfGeometryType,
                                     iDynTree::ModelSolidShapes & output)
{
    if (urdfGeometryType != "visual" && urdfGeometryType != "collision")
    {
        std::cerr << "[ERROR] unknown urdfGeometryType " << urdfGeometryType << std::endl;
        return false;
    }

    ModelLoader loader;
    ModelParserOptions options;
    options.originalFilename = urdf_filename;
    loader.setParsingOptions(options);
    bool ok = loader.loadModelFromString(urdf_string);

    if (ok && urdfGeometryType == "visual")
    {
        output = loader.model().visualSolidShapes();
    }

    if (ok && urdfGeometryType == "collision")
    {
        output = loader.model().collisionSolidShapes();
    }

    return ok;
}
开发者ID:robotology,项目名称:idyntree,代码行数:30,代码来源:URDFSolidShapesImport.cpp

示例2: solidShapesFromURDF

bool solidShapesFromURDF(const std::string & urdf_filename,
                         const Model & model,
                         const std::string urdfGeometryType,
                               ModelSolidShapes & output)
{
    if (urdfGeometryType != "visual" && urdfGeometryType != "collision")
    {
        std::cerr << "[ERROR] unknown urdfGeometryType " << urdfGeometryType << std::endl;
        return false;
    }

    ModelLoader loader;
    bool ok = loader.loadModelFromFile(urdf_filename);

    if (ok && urdfGeometryType == "visual")
    {
        output = loader.model().visualSolidShapes();
    }

    if (ok && urdfGeometryType == "collision")
    {
        output = loader.model().collisionSolidShapes();
    }

    return ok;
}
开发者ID:robotology,项目名称:idyntree,代码行数:26,代码来源:URDFSolidShapesImport.cpp

示例3: load

void Obj::load(string filename)
{
	this->name = filename;
	
	ModelLoader m;
	m.load_obj(filename, this);
}
开发者ID:joebain,项目名称:joebabies,代码行数:7,代码来源:Obj.cpp

示例4: getSensors

SensorsList getSensors(const std::string& fileName)
{
    ModelLoader loader;
    bool ok = loader.loadModelFromFile(fileName);
    // Load model
    ASSERT_IS_TRUE(ok);
    SensorsList sensorList = loader.sensors();

    return sensorList;
}
开发者ID:robotology,项目名称:idyntree,代码行数:10,代码来源:ReducedModelWithFTUnitTest.cpp

示例5: getModel

Model getModel(const std::string& fileName)
{
    ModelLoader loader;
    bool ok = loader.loadModelFromFile(fileName);
    // Load model
    ASSERT_IS_TRUE(ok);
    Model model = loader.model();

    return model;
}
开发者ID:robotology,项目名称:idyntree,代码行数:10,代码来源:ReducedModelWithFTUnitTest.cpp

示例6: ModelLoader

void Object::readFromFile(const char *filename) {
    
    ModelLoader loader = *new ModelLoader();
    loader.read_from_file(filename);
    
    vertices_counter = loader.vertexs_counter;
    indices_counter = loader.indexes_counter;
    
    vertices_array = loader.vertexes_out;
    indices_array = loader.indexes;
    
}
开发者ID:kudinovdenis,项目名称:Fast,代码行数:12,代码来源:Object.cpp

示例7: sizeof

Object::Object()
{
	try
	{
		position = { { 0., 0., 0. }, 0., 0., -1, 0, 0, false };
		scale = .1f;

		ModelLoader modelLoader;
		model = modelLoader.ReadModel("resources\\objects\\Captain America.obj", "resources\\objects\\Captain America.mtl");

		if (!model)
		{
			throw "Can't load player's geometry";
		}
		else
		{
			boundingBox.isShowing = false;
			calculateSizes();

		 	glGenBuffers(1, &tid);
			glBindBuffer(GL_ARRAY_BUFFER, tid);
			glBufferData(GL_ARRAY_BUFFER, model->UV_vertices.size()*sizeof(float), NULL, GL_STATIC_DRAW);
			glBufferSubData(GL_ARRAY_BUFFER, 0, model->UV_vertices.size()*sizeof(float), &model->UV_vertices[0]);
			glBindBuffer(GL_ARRAY_BUFFER, 0);

			glGenBuffers(1, &nid);
			glBindBuffer(GL_ARRAY_BUFFER, nid);
			glBufferData(GL_ARRAY_BUFFER, model->normals.size()*sizeof(float), NULL, GL_STATIC_DRAW);
			glBufferSubData(GL_ARRAY_BUFFER, 0, model->normals.size()*sizeof(float), &model->normals[0]);
			glBindBuffer(GL_ARRAY_BUFFER, 0);


			glGenBuffers(1, &vid);
			glBindBuffer(GL_ARRAY_BUFFER, vid);
			glBufferData(GL_ARRAY_BUFFER, model->vertices.size()*sizeof(float), NULL, GL_STATIC_DRAW);
			glBufferSubData(GL_ARRAY_BUFFER, 0, model->vertices.size()*sizeof(float), &model->vertices[0]);
			glBindBuffer(GL_ARRAY_BUFFER, 0);

			glGenBuffers(1, &bbvid);
			glBindBuffer(GL_ARRAY_BUFFER, bbvid);
			glBufferData(GL_ARRAY_BUFFER, 72 * sizeof(float), NULL, GL_STATIC_DRAW);
			glBufferSubData(GL_ARRAY_BUFFER, 0, 72 * sizeof(float), &boundingBox.coords[0]);
			glBindBuffer(GL_ARRAY_BUFFER, 0);
		}
	}
	catch (const char* error)
	{
		model = NULL;
		std::cout << error << std::endl;
	}

}
开发者ID:bannerspace,项目名称:foo,代码行数:52,代码来源:Object.cpp

示例8: Load

bool Model :: Load(std :: string name,ModelLoader &loader,Texture &tex)
{
	// attempt to load the file
	if(!loader.Load(name))
		return false;

	// do we have to clean up?
	if(frames)
		this->Clear();

	// get the model information
	int		modelframes=loader.GetNumFrames();
	int		nummeshes=loader.GetNumMeshes();
	float	modelfps=(float)loader.GetFPS();

	// tidy up the values
	if(modelframes<=0)
		return false;
	if(modelfps==0.0f)
		modelfps=1.0f;

	// and setup our model
	if(!this->Setup(modelframes,modelfps))
		return false;
	
	// now set up the frames
	for(int ct=0; ct<numframes; ct++)
	{
		// setup the frame
		if(!frames[ct].Setup(nummeshes))
		{
			this->Clear();
			return false;
		}
		
		// add the meshes
		for(int ct2=0; ct2<nummeshes; ct2++)
		{
			Mesh msh;	// temporary mesh
			
			// get the mesh
			if(!loader.Get(ct,ct2,&tex,&msh))
				return false;

			// and set it to the frame
			frames[ct].SetMesh(ct2,msh);
		}
	}

	// success
	return true;
}
开发者ID:2013chengguo,项目名称:geometrytest,代码行数:52,代码来源:model.cpp

示例9: makeScene

 Scene* makeScene(){
   ModelLoader loader;
   Object* o = loader.load("teapot.obj", true);
   o->setDrawMode( GL_TRIANGLES );// Render mode: triangluar mesh
   o->glSetTexture(0, "test0.png");// Texture
   o->glSetTexture(1, pSkyTech->getTexture() );  // Environment map.
   o->glSetTexture(2, pShadowTarget->getColorTexture() );  // Blurred shadows-only image. for soft-shadows.
   o->glSetTexture(3, pShadowsHV->getColorTexture() );
   o->glSetTexture(0, new Texture( GL_TEXTURE_2D, pCube->getTexture() ) );
   Scene* sc = new Scene();
   sc->addObject(o);
   return sc;
 }
开发者ID:SaipraveenB,项目名称:opengl-hdr,代码行数:13,代码来源:mygl.cpp

示例10: GetSetting

//----------------------------------------------------------------------------------
//
//----------------------------------------------------------------------------------
void EffectImplemented::UnloadResources()
{
	Setting* loader = GetSetting();
	
	TextureLoader* textureLoader = loader->GetTextureLoader();
	if( textureLoader != NULL )
	{
		for( int32_t ind = 0; ind < m_ImageCount; ind++ )
		{
			textureLoader->Unload( m_pImages[ind] );
			m_pImages[ind] = NULL;
		}

		for (int32_t ind = 0; ind < m_normalImageCount; ind++)
		{
			textureLoader->Unload(m_normalImages[ind]);
			m_normalImages[ind] = NULL;
		}

		for (int32_t ind = 0; ind < m_distortionImageCount; ind++)
		{
			textureLoader->Unload(m_distortionImages[ind]);
			m_distortionImages[ind] = NULL;
		}
	}

	SoundLoader* soundLoader = loader->GetSoundLoader();
	if( soundLoader != NULL )
	{
		for( int32_t ind = 0; ind < m_WaveCount; ind++ )
		{
			soundLoader->Unload( m_pWaves[ind] );
			m_pWaves[ind] = NULL;
		}
	}

	{
		ModelLoader* modelLoader = loader->GetModelLoader();
		if( modelLoader != NULL )
		{
			for( int32_t ind = 0; ind < m_modelCount; ind++ )
			{
				modelLoader->Unload( m_pModels[ind] );
				m_pModels[ind] = NULL;
			}
		}
	}
}
开发者ID:ariessanchezsulit,项目名称:Effekseer,代码行数:51,代码来源:Effekseer.Effect.cpp

示例11: ModelLoader

// Carga un ResourceMesh y guarda una referencia a este
ResourceMesh* ResourceManager::loadMesh(const char* filePath)
{
	ResourceMesh* mesh = NULL;
	ModelLoader* modelLoader = new ModelLoader();

	mesh = modelLoader->loadOBJ(filePath);

	// Si hay algun problema con el modelo cargamos uno de error por defecto
	if (mesh == NULL)
	{
		mesh = modelLoader->loadOBJ(Resources::MESH_ERROR);
	}

	mesh->fileName = filePath; //guardamos el filePath

	return mesh;
}
开发者ID:rubenmv,项目名称:SpaceDefenders,代码行数:18,代码来源:ResourceManager.cpp

示例12: InitModels

void MyGLWindow::InitModels()
{
	Chrono chrono;

	// load models
	ModelLoader modelLoader;

	chrono.start();
	_actorLib["Tank"] = modelLoader.LoadFromFile("./data/model/stankbot/models/stankbot.dae");
	_actorLib["Tank"]->SetShaderProgram(_shaderProgLib["defaultShader"]);
	std::cout << "Load stankbot (ms) : " << chrono.ellapsed() << std::endl;

	chrono.start();
	_actorLib["Dragon"] = modelLoader.LoadFromFile("./data/model/dragon_vrip_res3.ply");
	_actorLib["Dragon"]->SetShaderProgram(_shaderProgLib["defaultShader"]);
	std::cout << "Load dragon (ms) : " << chrono.ellapsed() << std::endl;
}
开发者ID:remia,项目名称:marching_cube,代码行数:17,代码来源:MyGLWindow.cpp

示例13: ModelLoader

TexturedModel::TexturedModel(Model model, std::vector<glm::vec2> uvs, GLuint textureID) {
	this->setVaoID(model.getVaoID());
	this->setVerticesVboID(model.getVerticesVboID());
	this->setVertexCount(model.getVertexCount());
	this->setScale(model.getScale());
	this->setPosition(model.getPosition());

	this->setTextured(true);

	ModelLoader modelLoader = ModelLoader();
	GLfloat *uvsTemp = &uvs[0].x;
	int uvsSize = uvs.size() * 2 * sizeof(GLfloat);

	this->uvVboID = modelLoader.storeData(2, uvsTemp, uvsSize);

	this->setColor(false);
	this->setColorsVboID(model.getColorsVboID());
}
开发者ID:imitablerabbit,项目名称:opengl-3d-engine,代码行数:18,代码来源:TexturedModel.cpp

示例14: saveResults

/* Asking user if he would like to save his model */
void saveResults(NNModel* model){
	cout << endl << "Would you like to save this model? (Press y/n)";

	/* Wait for y or n click*/
	char key = ' ';
	do{
		key = _getch();
	} while ((key != 'n') && (key != 'y'));
	 
	/* Saving model if needed */
	if (key == 'y'){
		cout << endl << endl << endl;
		string fileName;
		cout << "--Enter file name: "; cin >> fileName;
		
		ModelLoader m;
		m.saveModel(model, (char*)fileName.c_str());
	}
开发者ID:Streamline27,项目名称:NeuralNetwork,代码行数:19,代码来源:TrainingMode.cpp

示例15: QGLWidget

GLWidget::GLWidget(const QGLFormat & format, QWidget * parent) : QGLWidget(format, parent),
                                                                 mShaderProgram(this),
                                                                 mViewMatrix(),
                                                                 mProjectionMatrix(){

    float ratio = float(geometry().width())/float(geometry().height());
    mProjectionMatrix.perspective(60, ratio, .1, 100); // ortho(-5,5,-5,5,-5,5);//Orthogonal projection
    mViewMatrix.translate(0.0,0.0,-10.0);

    ModelLoader* loader = ModelFactory::getModelLoader("models/monkey.obj");
    if(loader != NULL){
        objTest = (StaticModel*)loader->loadModel();
    }
    objTest->mModelMatrix.translate(0,0,0);
    delete loader;

    manip = new SphereManipulator("cube manipulator", objTest);
    this->grabKeyboard();
}
开发者ID:mripley,项目名称:Fission,代码行数:19,代码来源:glwidget.cpp


注:本文中的ModelLoader类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。