void createInnerWalls(){
	// create large room walls
	scale.x = 5.0f;   scale.y = 4.0f; scale.z = 0.5f;
	trans.x = 11.0f;    trans.y = 0.0f; trans.z = 0.0f;
	innerWalls[0] = createMesh(scale, trans, wallHeight, 1); // left wall

	scale.x = 5.0f;   scale.y = 4.0f; scale.z = 0.5f;
	trans.x = 1.0f;    trans.y = 0.0f; trans.z = 0.0f;
	innerWalls[1] = createMesh(scale, trans, wallHeight, 1); // left wall

	scale.x = 3.0f;   scale.y = 4.0f; scale.z = 0.5f;
	trans.x = -13.0f; trans.y = 0.0f;  trans.z = 0.0f;
	innerWalls[2] = createMesh(scale, trans, wallHeight, 1); // front wall

	// create small room walls
	scale.x = 0.5f;   scale.y = 4.0f; scale.z = 3.0f;
	trans.x = 0.0f;  trans.y = 0.0f; trans.z = -13.0f;
	innerWalls[3] = createMesh(scale, trans, wallHeight, 1); // right wall

	scale.x = 0.5f;   scale.y = 4.0f; scale.z = 3.0f;
	trans.x = 0.0f;  trans.y = 0.0f; trans.z = -3.0f;
	innerWalls[4] = createMesh(scale, trans, wallHeight, 1); // right wall

	numInnerWalls = 5;
}
void fj::SurfaceConstruction::execute(const fj::Scalar &timestep, fj::ParticleSystem *particleSystem)
{
    for (auto& isosurface : m_surfaces)
    {
        isosurface.Mesh = createMesh(timestep, particleSystem, isosurface.getLevel());
    }
}
示例#3
0
MStatus animCube::compute(const MPlug& plug, MDataBlock& data)

{
	MStatus returnStatus;

	if (plug == outputMesh) {
		/* Get time */
		MDataHandle timeData = data.inputValue( time, &returnStatus ); 
		McheckErr(returnStatus, "Error getting time data handle\n");
		MTime time = timeData.asTime();

		/* Get output object */

		MDataHandle outputHandle = data.outputValue(outputMesh, &returnStatus);
		McheckErr(returnStatus, "ERROR getting polygon data handle\n");

		MFnMeshData dataCreator;
		MObject newOutputData = dataCreator.create(&returnStatus);
		McheckErr(returnStatus, "ERROR creating outputData");

		createMesh(time, newOutputData, returnStatus);
		McheckErr(returnStatus, "ERROR creating new Cube");

		outputHandle.set(newOutputData);
		data.setClean( plug );
	} else
		return MS::kUnknownParameter;

	return MS::kSuccess;
}
示例#4
0
const Mesh* MeshManager::createIcosahedron(std::string id)
{
    if(exists(id))
    {
        Logger::getInstance()->logWarning("MeshManager:: Mesh with id \"" + id + "\" already exists!");
        return nullptr;
    }

    // Code from OpenGL Programming Guide, Version 3
    const float x = 0.525731112119133606;
    const float z = 0.850650808352039932;

    glm::vec3 vertices[12] = {
        {-x, 0.0, z}, {x, 0.0, z}, {-x, 0.0, -z}, {x, 0.0, -z},
        {0.0, z, x}, {0.0, z, -x}, {0.0, -z, x}, {0.0, -z, -x},
        {z, x, 0.0}, {-z, x, 0.0}, {z, -x, 0.0}, {-z, -x, 0.0}
    };


    GLuint indices[20][3] = {
        {1, 4, 0}, {4, 9, 0}, {4, 5, 9}, {8, 5, 4},	{1, 8, 4},
        {1, 10, 8}, {10, 3, 8}, {8, 3, 5}, {3, 2, 5}, {3, 7, 2},
        {3, 10, 7}, {10, 6, 7}, {6, 11, 7}, {6, 0, 11},	{6, 1, 0},
        {10, 1, 6}, {11, 0, 9}, {2, 11, 9}, {5, 2, 9}, {11, 2, 7},
    };

    // Create the mesh
    const Mesh* mesh = createMesh(id, 12, vertices, 60, &indices[0][0]);
    return  mesh;
}
示例#5
0
ResourceId CResourceManager::loadMesh(const std::string& file)
{
    auto entry = m_meshFiles.find(file);
    if (entry != m_meshFiles.end())
    {
        return entry->second;
    }

    // Load mesh
	SMesh mesh;
	if (!load(file, mesh))
	{
		LOG_ERROR("Failed to load mesh from file %s.", file.c_str());
		return invalidResource;
	}

    // Create mesh resource
    ResourceId meshId = createMesh(mesh.m_vertices, mesh.m_indices, mesh.m_normals, mesh.m_uvs, mesh.m_type);
    if (meshId == invalidResource)
    {
        LOG_ERROR("Failed to create mesh resource id from file %s.", file.c_str());
        return invalidResource;
    }
    m_meshFiles[file] = meshId;
    return meshId;
}
Mesh* HUDImageRenderer::getMesh(const G3MRenderContext* rc) {
  if (_mesh == NULL) {
    if (!_creatingMesh) {
      if (_image == NULL) {
        _creatingMesh = true;

        const Camera* camera = rc->getCurrentCamera();

        const int width  = camera->getWidth();
        const int height = camera->getHeight();

        _imageFactory->create(rc,
                              width, height,
                              new HUDImageRenderer::ImageListener(this),
                              true);
      }
    }

    if (_image != NULL) {
      _mesh = createMesh(rc);
    }
  }
  
  return _mesh;
}
示例#7
0
void StCvOpDistort::setup(){
    gui = new ofxUICanvas();
    gui->init(212, 10, 200, 200);
    gui->addSpacer();
    gui->addLabel("OPTICAL PARTICLE");
    gui->addSpacer();
    gui->addSlider("PYR SCALE", 0, 0.99, 0.5);
    gui->addIntSlider("LEVELS", 1, 10, 5);
    gui->addIntSlider("WIN SIZE", 1, 100, 30);
    gui->addIntSlider("ITERATION", 1, 20, 2);
    gui->addToggle("GAUSS", false);
    gui->addSpacer();
    gui->addSlider("THRESH", 0, 2.0, 1.0);
    gui->addIntSlider("SKIP", 1, 10, 1);
    gui->addSlider("TOP SHIFT", 0, 100.0, 50.0);
    gui->addSpacer();
    gui->addSlider("HUE", 0, 2.0, 1.0);
    gui->addSlider("SAT", 0, 2.0, 1.0);
    gui->addSlider("BR", 0, 2.0, 1.0);
    gui->addSpacer();
    gui->addButton("SAVE SETTINGS", false);
    gui->loadSettings("StCvOpDistort.xml");
    gui->autoSizeToFitWidgets();
    gui->setVisible(false);
    ofAddListener(gui->newGUIEvent,this,&StCvOpDistort::guiEvent);
    
    app = ((ofApp*)ofGetAppPtr());
    
    createMesh();
}
//initialise the display settings
void myInit()
{
    createMesh();
    generateWinterMesh();
    generateFallMesh();
    generateSummerMesh();
    generateSpringMesh();
	produceTrees_spring();
	produceTrees_summer();
	produceTrees_autumn();
	produceTrees_winter();
  generateCloud();
	drawTrees();
    GLfloat lightIntensity[] = { 0.8, 0.8, 0.8, 1.0f};
	GLfloat lightIntensity2[] = { 0.8, 0.8, 0.8, 1.0f };
    GLfloat lightPosition[] = {0.0f, 1.0f, 0.0f, 0.0f};
	GLfloat lightPosition2[] = { 0.0f, -1.0f, 0.0f, 0.0f };
    glLightfv(GL_LIGHT0, GL_POSITION, lightPosition);
    glLightfv(GL_LIGHT0, GL_AMBIENT, lightIntensity);
	glLightfv(GL_LIGHT1, GL_POSITION, lightPosition2);
	glLightfv(GL_LIGHT1, GL_AMBIENT, lightIntensity2);
    Point3 eye, look;
    Vector3 up;
    eye.set(1,1,1); //set the eye location
    look.set(0,0,0); //set the look at coord
    up.set(0,1,0); //specify the up vector
    cam.set(eye, look, up); // make the initial camera
    cam.slide(0,0, 1.5);
    cam.setShape(30.0f, 1.0f, 0.5f, 50.0f);
}
示例#9
0
文件: main.cpp 项目: DanGrise/HugMe
void hapticsLoop(void* a_pUserData)
{
    if (create_mesh_flag == 1)
    {
        createMesh();
        create_mesh_flag = 0;
    }

    syncPoses();
    cursor->computeGlobalPositions(1);

    // read the position of the haptic device
    cursor->updatePose();

    // compute forces between the cursor and the environment
    cursor->computeForces();

    // send forces to haptic device
    cursor->applyForces();

    inContact = -1;
    for (unsigned int i=0; i<cursor->m_pointForceAlgos.size(); i++)
    {
        cProxyPointForceAlgo* cur_proxy = dynamic_cast<cProxyPointForceAlgo*>(cursor->m_pointForceAlgos[i]);
        if ((cur_proxy != NULL) && (cur_proxy->getContactObject() != NULL)) 
        {      
            lastContactPoint = cur_proxy->getContactPoint();
            lastForce = cursor->m_lastComputedGlobalForce;
            inContact = i;
            break;
        }
    }
    
}
示例#10
0
void Shape2D::update()
{
    if (_isMeshDirty)
    {
        createMesh();
    }
}
示例#11
0
void StFftSphereRibbon::setup(){
    gui = new ofxUICanvas();
    gui->init(212, 10, 200, 200);
    gui->addSpacer();
    gui->addLabel("STRIPE SPHERE");
    gui->addSpacer();
    gui->addSlider("NOISE SCALE", 0.0, 5.0, 1.0);
    gui->addSlider("SHIFT SPEED", 0.0, 2.0, 1.0);
    gui->addSlider("INTERPORATION", 0.0, 1.0, 0.2);
    gui->addSlider("RIBBON WIDTH", 0.0, 10.0, 4.0);
    gui->addSlider("ZOOM", 0.0, 3.0, 1.0);
    gui->addSpacer();
    gui->addSlider("HUE", 0, 2.0, 1.0);
    gui->addSlider("SAT", 0, 2.0, 1.0);
    gui->addSlider("BR", 0, 2.0, 1.0);
    gui->addSpacer();
    gui->addButton("SAVE SETTINGS", false);
    gui->loadSettings("StFftSphereRibbon.xml");
    gui->autoSizeToFitWidgets();
    gui->setVisible(false);
    ofAddListener(gui->newGUIEvent,this,&StFftSphereRibbon::guiEvent);
    app = ((ofApp*)ofGetAppPtr());
    
    post.init(app->drawFbo->width, app->drawFbo->height);
    post.createPass<BloomPass>()->setEnabled(true);

    createMesh();
}
示例#12
0
void Object::create()
{
  clearObject();

  scale_.x = bounding_box_lwh_.x;
  scale_.y = bounding_box_lwh_.y;
  scale_.z = bounding_box_lwh_.z;

  object_.header.frame_id = frame_id_;
  object_.name = name_;
  //object_.description = description_;
  object_.pose = pose_;
  object_.scale = maxScale(scale_);

  createMesh();

  control_.name = "object_control";
  control_.interaction_mode = InteractiveMarkerControl::BUTTON;
  control_.always_visible = true;
  control_.markers.push_back(mesh_);

  object_.controls.clear();
  object_.controls.push_back(control_);

  if (scale_.x != 0.0f && scale_.y != 0.0f && scale_.z != 0.0f)
    BoundingBox::createBoundingBoxControl(0.0f, 0.0f, 0.0f);

  createMenu();
}
示例#13
0
// -------------------------------------------------------------------
//	Set a new material definition as the current material.
void ObjFileParser::getNewMaterial()
{
	m_DataIt = getNextToken<DataArrayIt>(m_DataIt, m_DataItEnd);
	m_DataIt = getNextWord<DataArrayIt>(m_DataIt, m_DataItEnd);
    if( m_DataIt == m_DataItEnd ) {
        return;
    }

	char *pStart = &(*m_DataIt);
	std::string strMat( pStart, *m_DataIt );
    while( m_DataIt != m_DataItEnd && isSeparator( *m_DataIt ) ) {
        ++m_DataIt;
    }
	std::map<std::string, ObjFile::Material*>::iterator it = m_pModel->m_MaterialMap.find( strMat );
	if ( it == m_pModel->m_MaterialMap.end() )
	{
		// Show a warning, if material was not found
		DefaultLogger::get()->warn("OBJ: Unsupported material requested: " + strMat);
		m_pModel->m_pCurrentMaterial = m_pModel->m_pDefaultMaterial;
	}
	else
	{
		// Set new material
		if ( needsNewMesh( strMat ) )
		{
			createMesh();	
		}
		m_pModel->m_pCurrentMesh->m_uiMaterialIndex = getMaterialIndex( strMat );
	}

	m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
}
示例#14
0
void AwarenessVisualizer::buildVisualizationForAllTiles()
{
	std::function<void(unsigned int, dtTileCachePolyMesh&, float* origin, float cellsize, float cellheight, dtTileCacheLayer& layer)> processor = [this](unsigned int tileRef, dtTileCachePolyMesh& pmesh, float* origin, float cellsize, float cellheight, dtTileCacheLayer& layer) {
		createMesh(tileRef, pmesh, origin, cellsize, cellheight, layer);
	};

	mAwareness.processAllTiles(processor);
}
示例#15
0
Icosahedron::Icosahedron( string iName, real ir, const Material& mat ) 
{
  r = ir ;
  name = iName ;
  material = mat ;

  createMesh( defaultMeshType, defaultVertexType ) ;
}
示例#16
0
const GLC_BoundingBox& GLC_Sphere::boundingBox()
{
	if ( GLC_Mesh::isEmpty() )
	{
		createMesh();
	}
	return GLC_Mesh::boundingBox();
}
RigidSphere::RigidSphere()
{
	m_radius = 0.38f;
	m_radius2 = m_radius * m_radius;
	createMesh(m_radius, 18, 18);
	m_pShader = new ModelViewProjectionShader("resource/shaders/ball.vert", "resource/shaders/ball.frag");
	reset(false);
}
示例#18
0
void main()
{
    try {
        // ビューアーを作成する
        pcl::visualization::PCLVisualizer viewer( "Point Cloud Viewer" );

        // 点群
        pcl::PointCloud<PointType>::Ptr cloud1( new pcl::PointCloud<PointType> );
        pcl::PointCloud<PointType>::Ptr cloud2( new pcl::PointCloud<PointType> );

        // PLYファイルを読み込む
        pcl::PLYReader reader;
        reader.read( "model1.ply", *cloud1 );
        reader.read( "model2.ply", *cloud2 );

        // ビューアーに追加して更新(Qキーで次の処理へ)
        viewer.addPointCloud( cloud1, "cloud1" );
        viewer.addPointCloud( cloud2, "cloud2" );
        viewer.spin();

        // VoxelGrid Filter
        voxelGridFilter( cloud1 );
        voxelGridFilter( cloud2 );

        // 位置合わせ
        iterativeClosestPoint( cloud1, cloud2 );

        // ビューアーを更新する(Qキーで次の処理へ)
        viewer.updatePointCloud( cloud1, "cloud1" );
        viewer.updatePointCloud( cloud2, "cloud2" );
        viewer.spin();

        // 点群をマージして重複を削除する
        *cloud1 += *cloud2;
        voxelGridFilter( cloud1 );

        // PLYファイルとして書き出す
        pcl::PLYWriter writer;
        writer.write( "output.ply", *cloud1 );

        // ビューアーを更新する(Qキーで次の処理へ)
        viewer.updatePointCloud( cloud1, "cloud1" );
        viewer.removePointCloud( "cloud2" );
        viewer.spin();

        // メッシュ化してファイルに出力
        auto triangles = createMesh( cloud1 );
        pcl::io::savePLYFile( "output-mesh.ply", triangles );

        // 表示を更新(Qキーで次の処理へ)
        viewer.removeAllPointClouds();
        viewer.addPolygonMesh( triangles );
        viewer.spin();
    }
    catch ( std::exception& ex ){
        std::cout << ex.what() << std::endl;
    }
}
示例#19
0
void AwarenessVisualizer::buildVisualization(const WFMath::AxisBox<2>& area)
{
	std::function<void(unsigned int, dtTileCachePolyMesh&, float* origin, float cellsize, float cellheight, dtTileCacheLayer& layer)> processor = [this](unsigned int tileRef, dtTileCachePolyMesh& pmesh, float* origin, float cellsize, float cellheight, dtTileCacheLayer& layer) {
		createMesh(tileRef, pmesh, origin, cellsize, cellheight, layer);
	};

	mAwareness.processTiles(area, processor);

}
示例#20
0
//------------------------------------------------------------
void ofxPolyline::draw(int begin, int end) {
    
    if (begin >= end) {
        return;
    }
    
    // Create a mesh of polyline
    ofMesh mesh;
    createMesh(mesh, begin, end);
    
    // Draw
    for (int i=0; i<2; i++) {
        // For statement for ofNoFill() and ofFill()
        if (i == 0) {
            // No fill for antialias
            ofNoFill();
            mesh.drawWireframe();
        } else if (i == 1) {
            // Fill
            ofFill();
            mesh.draw();
        }
        
        // Draw ends of line
        if (strokeLinecap == OFXSVG_STROKE_LINECAP_BUTT) {
            ;
        } else if (strokeLinecap == OFXSVG_STROKE_LINECAP_ROUND) {
            ofCircle((*this)[begin], width/2);
            ofCircle((*this)[end], width/2);
        } else if (strokeLinecap == OFXSVG_STROKE_LINECAP_SQUARE) {
            ofPushStyle();
            ofSetRectMode(OF_RECTMODE_CENTER);
            for (int j=0; j<2; j++) {
                int index;
                float capXOffset;
                if (j == 0) {
                    index = begin;
                    capXOffset = -width/4.0;
                } else if (j == 1) {
                    index = end;
                    capXOffset = width/4.0;
                }
                ofVec3f rotation3 = getNormalAtIndex(index);
                ofVec2f rotation = ofVec2f(rotation3);
                rotation.rotate(90);  // Normal to line direction
                float angle = ofVec2f(1.0, 0.0).angle(rotation);
                ofPushMatrix();
                ofTranslate((*this)[index].x, (*this)[index].y);
                ofRotate(angle);
                ofRect(capXOffset, 0, width/2, width);
                ofPopMatrix();
            }
            ofPopStyle();
        }
    }
    ofNoFill();
}
示例#21
0
void GLC_Sphere::glDraw(const GLC_RenderProperties& renderProperties)
{
	if (GLC_Mesh::isEmpty())
	{
		createMesh();
	}

	GLC_Mesh::glDraw(renderProperties);
}
示例#22
0
void AwarenessVisualizer::Awareness_TileUpdated(int tx, int ty)
{
	if (mTileVisualizationEnabled) {
		std::function<void(unsigned int, dtTileCachePolyMesh&, float* origin, float cellsize, float cellheight, dtTileCacheLayer& layer)> processor = [this](unsigned int tileRef, dtTileCachePolyMesh& pmesh, float* origin, float cellsize, float cellheight, dtTileCacheLayer& layer) {
			createMesh(tileRef, pmesh, origin, cellsize, cellheight, layer);
		};

		mAwareness.processTile(tx, ty, processor);
	}
}
示例#23
0
文件: voxels.c 项目: kyle1320/voxels
Chunk * createChunk(int x, int y, int z) {
    Chunk *chunk = calloc(1, sizeof(Chunk));

    chunk->x = x;
    chunk->y = y;
    chunk->z = z;

    chunk->mesh = createMesh();

    return chunk;
}
示例#24
0
GLC_Sphere::GLC_Sphere(const GLC_Sphere & sphere)
:GLC_Mesh(sphere)
, m_Radius (sphere.m_Radius)
, m_Discret(sphere.m_Discret)
, m_ThetaMin (sphere.m_ThetaMin)
, m_ThetaMax(sphere.m_ThetaMax)
, m_PhiMin(sphere.m_PhiMin)
, m_PhiMax(sphere.m_PhiMax)
{
	createMesh();
}
void createBoundaryWalls(){
	// create in counterclockwise direction/sequence
	scale.x = 0.5f;   scale.y = 4.0f; scale.z = 16.0f;
	trans.x = -16.0f; trans.y = 0.0f; trans.z = 0.0f;
	boundaryWalls[0] = createMesh(scale, trans, wallHeight, 1); // left wall

	scale.x = 16.0f;  scale.y = 4.0f; scale.z = 0.5f;
	trans.x = 0.0f;   trans.y = 0.0f; trans.z = 16.0f;
	boundaryWalls[1] = createMesh(scale, trans, wallHeight, 1); // front wall

	scale.x = 0.5f;   scale.y = 4.0f; scale.z = 16.0f;
	trans.x = 16.0f;  trans.y = 0.0f; trans.z = 0.0f;
	boundaryWalls[2] = createMesh(scale, trans, wallHeight, 1); // right wall

	scale.x = 16.0f;  scale.y = 4.0f; scale.z = 0.5f;
	trans.x = 0.0f;   trans.y = 0.0f; trans.z = -16.0f;
	boundaryWalls[3] = createMesh(scale, trans, wallHeight, 1); // back wall

	numBoundaryWalls = 4;
}
示例#26
0
GLC_Sphere::GLC_Sphere(double radius)
: GLC_Mesh()
, m_Radius (radius)
, m_Discret(glc::GLC_POLYDISCRET)
, m_ThetaMin (0.0)
, m_ThetaMax(2 * glc::PI)
, m_PhiMin(-glc::PI / 2.0)
, m_PhiMax(glc::PI / 2.0)
{
	createMesh();
}
示例#27
0
int
main(int argc, char *argv[])
{
	PetscInitialize(&argc, &argv, NULL, NULL);

	PetscInt polyDegree = 4;
	DM meshSkeleton = createMesh(PETSC_COMM_WORLD, "../test_files/small.ex2");
	meshSkeleton = createSection(meshSkeleton, polyDegree);
	PetscFinalize();
	return 0;
}
示例#28
0
// -------------------------------------------------------------------
//  Get values for a new material description
void ObjFileParser::getMaterialDesc()
{
    // Get next data for material data
    m_DataIt = getNextToken<DataArrayIt>(m_DataIt, m_DataItEnd);
    if (m_DataIt == m_DataItEnd) {
        return;
    }

    char *pStart = &(*m_DataIt);
    while( m_DataIt != m_DataItEnd && !IsLineEnd( *m_DataIt ) ) {
        ++m_DataIt;
    }

    // In some cases we should ignore this 'usemtl' command, this variable helps us to do so
    bool skip = false;

    // Get name
    std::string strName(pStart, &(*m_DataIt));
    strName = trim_whitespaces(strName);
    if (strName.empty())
        skip = true;

    // If the current mesh has the same material, we simply ignore that 'usemtl' command
    // There is no need to create another object or even mesh here
    if (m_pModel->m_pCurrentMaterial && m_pModel->m_pCurrentMaterial->MaterialName == aiString(strName))
        skip = true;

    if (!skip)
    {
        // Search for material
        std::map<std::string, ObjFile::Material*>::iterator it = m_pModel->m_MaterialMap.find(strName);
        if (it == m_pModel->m_MaterialMap.end())
        {
            // Not found, use default material
            m_pModel->m_pCurrentMaterial = m_pModel->m_pDefaultMaterial;
            DefaultLogger::get()->error("OBJ: failed to locate material " + strName + ", skipping");
            strName = m_pModel->m_pDefaultMaterial->MaterialName.C_Str();
        }
        else
        {
            // Found, using detected material
            m_pModel->m_pCurrentMaterial = (*it).second;
        }

        if (needsNewMesh(strName))
            createMesh(strName);

        m_pModel->m_pCurrentMesh->m_uiMaterialIndex = getMaterialIndex(strName);
    }

    // Skip rest of line
    m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
}
示例#29
0
	//================================================================================
	//!	メソッド名	CMESH_BASE::initializeMesh
	//
	//	機能		メッシュの初期化
	//	引数		inDev			Direct3Dデバイス
	//				inName			Xファイルの名称
	//				inResource		メッシュフォルダ名
	//				inTexture		テクスチャフォルダ名
	//	更新		2007/12/08		<新規>
	//================================================================================
	void
	CMESH_BASE::initializeMesh(	CONST DEV	inDev,
								CONST LPSTR inName,
								CONST LPSTR	inResource,
								CONST LPSTR	inTexture)
	{
	//	メッシュの初期解放
		finishalizeMesh();

	//	メッシュマップが無ければ生成する
		if(	!mMeshs)
		{
			mMeshs = new map<string, MESH_DATA*>;
		}

	//	作業用イテレータ
		map<string, MESH_DATA*>::iterator	p;
	//	メッシュマップにXファイル名を渡し、そのイテレータを受け取る
		p = mMeshs->find(inName);

	//	メッシュマップに同じ名前のXファイル名が既に登録してある場合
		if(	p != mMeshs->end())
		{
		//	使用カウンタを増やす
			p->second->cnt++;
		//	メッシュ情報を返す
			md_ptr		= (*p).second;
		//	ロード完了
			bMeshLoaded	= TRUE;
		}
		else
		{
		//	新たにメッシュを生成する
			md_ptr	= createMesh(inDev, inName, inResource, inTexture);

		//	生成に成功した場合
			if(	md_ptr)
			{
			//	使用カウンタを増やす
				md_ptr->cnt++;
			//	ロード完了
				bMeshLoaded	= TRUE;
			//	メッシュマップに登録
				mMeshs->insert(pair<string, MESH_DATA*>(md_ptr->name, md_ptr));
			}
		//	失敗した場合
			else
			{
			//	ロード未完了
				bMeshLoaded	= FALSE;
			}
		}
	}
示例#30
0
MeshPtr getMesh( const std::string& file_path )
{
	if ( mesh_map[file_path] == nullptr )
	{
		mesh_map[file_path] = createMesh( file_path );
		if ( mesh_map[file_path] == nullptr ) 
		{
			throw std::runtime_error("cant find mesh " + file_path);
		} 
	} 
	return mesh_map[file_path];
}