コード例 #1
0
ファイル: SkillObject.cpp プロジェクト: gasbank/poolg
HRESULT SkillObject::frameRender ( IDirect3DDevice9* pd3dDevice, double dTime, float fElapsedTime )
{
	HRESULT f = 0;
	D3DPERF_BeginEvent( 0, L"SkillObject Render" );

	HRESULT hr = S_OK;
	ArnMatrix mWorld;
	ArnMatrixIdentity( &mWorld );
	UINT iPass, cPasses;
	if ( SUCCEEDED(g_bombShader->setMainTechnique()) )
	{
		ArnMatrix arnvm, arnpm;
		memcpy(arnvm.m, GetG().m_camera.GetViewMatrix()->m, sizeof(float)*16);
		memcpy(arnpm.m, GetG().m_camera.GetProjMatrix()->m, sizeof(float)*16);

		V( g_bombShader->setWorldViewProj( dTime, fElapsedTime, &getLocalXform(), &arnvm, &arnpm) );

		V( g_bombShader->begin( &cPasses, 0 ) );
		for( iPass = 0; iPass < cPasses; iPass++ )
		{
			V( g_bombShader->beginPass( iPass ) );

			// TODO Mesh pointing should be done here? not OnResetDevice?
			if ( getMesh() == 0 )
			{
				setMesh( g_bst[ m_bst ] );
			}

			f = getMesh()->DrawSubset( 0 );

			V( g_bombShader->endPass() );
		}
		V( g_bombShader->end() );
	}
	else
	{
		// TODO Mesh pointing should be done here? not OnResetDevice?
		if ( getMesh() == 0 )
		{
			setMesh( g_bst[ m_bst ] );
		}
		pd3dDevice->SetTransform(D3DTS_WORLD, (const D3DXMATRIX*)getLocalXform().m);
		f = getMesh()->DrawSubset( 0 );
	}
	

	D3DPERF_EndEvent();
	return f;
}
コード例 #2
0
ファイル: Bullet.cpp プロジェクト: hulcyp/GuildhallProjects
	Bullet::Bullet( const std::string& id, const vec2f& pos, float rotation, short teamNumber, int screenWidth, int screenHeight, bool isServerSide )
		:	SpaceGameActor( id + "_" + toString( sm_nextBulletID++ ), teamNumber, screenWidth, screenHeight )
		,	BULLET_SPEED( 500.0f )
	{
		m_actorType = BULLET_ACTOR_TYPE;
		setPosition( pos );
		m_lifespan = 2.0f;
		m_drag = 0.0f;
		m_radius = 4.0f;
		SGA_State currentState;
		currentState.pos = pos;
		currentState.rot = rotation;
		m_stateTimeline.SetDrag( m_drag );

		const float radians = MathFuncs<float>::degreesToRadians( rotation );
		const float sinRotation = std::sin( radians );
		const float cosRotation = std::cos( radians );

		vec2f dir = vec2f( sinRotation, cosRotation );
		currentState.vel = dir * BULLET_SPEED;		

		if( !isServerSide )
			setMesh( MeshFactory::generateLine( vec2f(), vec2f( 0.0f, 4.0f ), "SimpleColorMaterial", getTeamColor( teamNumber ) ) );
		
		setRotation( mat3f::createMatrixFromQuaternion( quatf::makeQuaternionFromAxisAngle( MathFuncs<float>::degreesToRadians( rotation ), vec3f( 0.0f, 0.0f, 1.0f ) ) ) );

		m_stateTimeline.Set( 0, currentState );
		m_actorTypesCanCollideWith = SPACE_SHIP_ACTOR_TYPE;
	}
コード例 #3
0
void StandardRenderer::render(ID3D11Device* pd3dDevice, ID3D11DeviceContext* pd3dImmediateContext, GameObject* gameObject)
{
	// simplest possible renderer

	// get world matrix
	XMMATRIX worldMatrix = gameObject->transformMatrix;

	// only supports one parent at moment
	if (gameObject->parent)
	{
		// for some reason it breaks if you remove this line...
		// it could be something to do with the warning C4316
		XMMATRIX parentTransform = gameObject->parent->transformMatrix;

		worldMatrix *= parentTransform;
	}

	GameContext * gameContext = gameObject->gameContext;

	XMMATRIX viewMatrix = gameContext->renderingContext->primaryCamera->viewMatrix;
	XMMATRIX projectionMatrix = gameContext->renderingContext->projectionMatrix;
	XMMATRIX matWorldViewProjection = worldMatrix * viewMatrix * projectionMatrix;

	// update constant buffers
	gameObject->shaderPair->updateBuffersPerObject(pd3dImmediateContext, worldMatrix, matWorldViewProjection, XMFLOAT4(1, 1, 1, 1));

	setMesh(pd3dImmediateContext, gameObject->sharedMesh);

	renderMesh(pd3dImmediateContext, gameObject->sharedMesh);
}
コード例 #4
0
ファイル: InstancedSponge.cpp プロジェクト: lubosz/liblub
 InstancedSponge::InstancedSponge(unsigned recursion, QList<string>& attributes) {
     bufferCount = 1;
     makeSponge(recursion, {0, 0, 0}, 1.0f);
     setMesh(MeshLoader::load(attributes, "cube.obj"));
     calculateBufferSize();
     setCastShadows(false);
 }
コード例 #5
0
ファイル: infowidgetmsh.cpp プロジェクト: nfaralli/BPV
void InfoWidgetMsh::loadParticles(Particles *particles){
    int k;
    if(mSpec!=NULL)
      free(mSpec);
    mSpec=NULL;
    nbMeshes=0;
    if(particles!=NULL){
        nbMeshes=particles->nbMeshes;
        mSpec=(MeshSpec*)calloc(nbMeshes,sizeof(MeshSpec));
        memcpy(mSpec,particles->mSpec,nbMeshes*sizeof(MeshSpec));
        while(meshBx->count())
          meshBx->removeItem(meshBx->count()-1);
        for(k=0;k<nbMeshes;k++)
          meshBx->addItem(mSpec[k].name);
        meshBx->setCurrentIndex(0);
        wireBx->setChecked(mSpec[0].showWires);
        cullBackFaceBx->setChecked(mSpec[0].cullBackFace);
        setMesh(0);
        setChecked(true);
        setEnabled(true);
    }
    else {
        while(meshBx->count())
          meshBx->removeItem(meshBx->count()-1);
        setChecked(false);
        setEnabled(false);
    }
}
コード例 #6
0
bool Cc3dSprite::init(){
    this->setAnchorPoint(ccp(0,0));
    //call parent init
    Cc3dNode::init();
    //texture
	CCTexture2D*texture=CCTextureCache::sharedTextureCache()->addImage((c3dDefaultTexPicFolderPath+"defaultTexPic.png").c_str());
    setTexture(texture);
    //material
    Cc3dMaterial*material=Cc3dMaterial::create();
    setMaterial(material);
    //mesh
    Cc3dMesh*mesh=Cc3dMesh::create();//empty mesh
    setMesh(mesh);
    //program
    Cc3dProgram*program=c3dGetProgram_c3dTexOnly();
    setProgram(program);
    //uniformPassor
    Cc3dUniformPassor*uniformPassor=Cc3dUniformPassor::create();
    setUniformPassor(uniformPassor);
    //lightSource
    Cc3dLightSource*lightSource=Cc3dLightSource::create();
    setLightSource(lightSource);
    //indexVBO
    Cc3dIndexVBO3d*indexVBO=Cc3dIndexVBO3d::create();
    setIndexVBO(indexVBO);
    //enable array attribute
    Cc3dIndexVBO3d::enableAttribArrays();
    return true;
}
コード例 #7
0
ファイル: TriggerObject.cpp プロジェクト: barryHub20/SP3
void TriggerObject::Update(double dt, bool* myKey)
{
	updateTrigger(dt, myKey); //Actual update

	//Sprite animation
	switch (type)
	{
	case FIRE:
	{
		setState(FIRE);
		if (animationList[FIRE]->ended == true)
		{
			animationList[FIRE]->Reset();
			if(this->getActive() == true)
			{
				my_sfx_man->play_fire();
			}
		}

		if (mesh != animationList[FIRE])
		{
			setMesh(animationList[FIRE]);
		}
		animationList[FIRE]->Update(dt);

		break;
	}
	}
}
コード例 #8
0
ファイル: Collider.cpp プロジェクト: Another-Game-Engine/AGE
	void Collider::_copyFrom(const ComponentBase *model)
	{
		auto m = (Collider*)model;
		if (m->getColliderType() == Physics::ColliderType::Mesh)
		{
			init(m->getColliderType(), m->getMesh());
		}
		else
		{
			init(m->getColliderType(), "");
		}
#ifdef EDITOR_ENABLED
		editorUpdate();
		if (editorStruct)
		{
			editorStruct->copyDatas(m);
		}
		Link *link = entity.getLinkPtr();
		auto p = scaleFromMat4(link->getGlobalTransform());
		//scale(p / getSize());
#else
		setMaterial(m->getMaterial()->getName());
		setAsTrigger(m->isATrigger());
		setFilterGroup(m->getFilterGroup());
		setCenter(m->getCenter());
		setHeight(m->getHeight());
		setRadius(m->getRadius());
		setSize(m->getSize());
		setMesh(m->getMesh());
		if (m->isConvex())
			setAsConvex();
		else if (m->isConcave())
			setAsConcave();
#endif
	}
コード例 #9
0
void CC3PODMeshNode::initAtIndex( GLint aPODIndex, CC3PODResource* aPODRez )
{
    init();
    setPodIndex( aPODIndex );
    
    SPODNode* pmn = (SPODNode*)getNodePODStructAtIndex( aPODIndex, aPODRez );
    
    //LogRez(@"Creating %@ at index %i from: %@", [self class], aPODIndex, NSStringFromSPODNode(psn));
    setName( pmn->pszName );
    setPodContentIndex( pmn->nIdx );
    setPodParentIndex( pmn->nIdxParent );
    
    if ( pmn->pfAnimPosition )
        setLocation( *(CC3Vector*)pmn->pfAnimPosition );
    if ( pmn->pfAnimRotation )
        setQuaternion( *(CC3Quaternion*)pmn->pfAnimRotation );
    if ( pmn->pfAnimScale )
        setScale( *(CC3Vector*)pmn->pfAnimScale );
    
    if ( CC3PODNodeAnimation::sPODNodeDoesContainAnimation((PODStructPtr)pmn) )
        setAnimation( CC3PODNodeAnimation::animationFromSPODNode( (PODStructPtr)pmn, aPODRez->getAnimationFrameCount() ) );
    else if (aPODRez->shouldFreezeInanimateNodes())
        setAnimation( CC3FrozenNodeAnimation::animationFromNodeState( this ) );

	// If this node has a mesh, build it
	if (getPodContentIndex() >= 0) {
		setMesh( aPODRez->getMeshAtIndex( getPodContentIndex() ) );
	}
	// If this node has a material, build it
	setPodMaterialIndex( pmn->nIdxMaterial );
	if (getPodMaterialIndex() >= 0)
		setMaterial( (CC3PODMaterial*)aPODRez->getMaterialAtIndex( getPodMaterialIndex() ) );
}
コード例 #10
0
void CC3Billboard::populateAsBoundingRectangle()
{
	CC3Vector* vertices;		// Array of simple vertex location data

	// Start with default initial values
	GLfloat xMin = 0.0f;
	GLfloat xMax = 1.0f;
	GLfloat yMin = 0.0f;
	GLfloat yMax = 1.0f;
	int vCount = 4;
	
	CC3VertexLocations* locArray = CC3VertexLocations::vertexArray();
	locArray->setDrawingMode( GL_TRIANGLE_STRIP );			// Location array will do the drawing as a strip
	locArray->setVertexStride( 0 );							// Tightly packed locations only
	locArray->setElementOffset( 0 );							// Only locations
	locArray->setAllocatedVertexCapacity( vCount );
	vertices = (CC3Vector*)locArray->getVertices();
	
	// Populate vertex locations in the X-Y plane
	vertices[0] = cc3v(xMax, yMax, 0.0f);
	vertices[1] = cc3v(xMin, yMax, 0.0f);
	vertices[2] = cc3v(xMax, yMin, 0.0f);
	vertices[3] = cc3v(xMin, yMin, 0.0f);
	
	// Create mesh with vertex location array
	CC3Mesh* aMesh = CC3Mesh::mesh();
	aMesh->setVertexLocations( locArray );
	setMesh( aMesh );

	updateBoundingMesh();
}
コード例 #11
0
	//----------------------------------------------------------------------
	void Spaceship::createMesh( const Color4f& color )
	{
		std::vector< Mesh::Vertex > vertices;
		std::vector< unsigned int > indices;
		
		vertices.push_back(	Mesh::Vertex(	vec3f( 0.0f, 20.0f ),
											vec3f( 0.0f, 0.0f, 1.0f ),
											color,
											vec2f() ) );
		vertices.push_back(	Mesh::Vertex(	vec3f( 15.0f, -20.0f ),
											vec3f( 0.0f, 0.0f, 1.0f ),
											color,
											vec2f() ) );
		vertices.push_back(	Mesh::Vertex(	vec3f( 0.0f, -10.0f ),
											vec3f( 0.0f, 0.0f, 1.0f ),
											color,
											vec2f() ) );
		vertices.push_back(	Mesh::Vertex(	vec3f( -15.0f, -20.0f ),
											vec3f( 0.0f, 0.0f, 1.0f ),
											color,
											vec2f() ) );
		
		indices.push_back( 0 );
		indices.push_back( 1 );
		indices.push_back( 2 );
		indices.push_back( 3 );
		
		setMesh( new Mesh( vertices, indices, "SimpleColorMaterial", GL_LINE_LOOP ) );
	}
コード例 #12
0
ファイル: SubMesh.cpp プロジェクト: MrGlamur/libgdx-cpp
SubMesh::SubMesh(const char* newName, const Mesh& mesh, int primitiveType, Material* material)
: name(newName)
{
	setMesh(mesh);
	this->primitiveType = primitiveType;
	this->material = material;
}
コード例 #13
0
ファイル: CC3MeshNode.cpp プロジェクト: ClAndHHL/cocos3d-x
/** If a mesh does not yet exist, create it as a CC3Mesh with interleaved vertices. */
CC3Mesh* CC3MeshNode::ensureMesh()
{
	if ( !_mesh ) 
		setMesh( makeMesh() );

	return _mesh;
}
コード例 #14
0
void EntityGridObject::toggleObject(GridMap * currMap)
{
	if (!m_bToggled)
	{
		m_bToggled = true;
	}
	else
	{
		m_bToggled = false;
	}

	auto graphicsComponent = this->getComponent<GraphicsComponent>();
	Mesh * newMesh;

	switch (this->m_eObjectType)
	{
	case OBJECT_BOX:
		break;
	case OBJECT_KEY:
		break;
	case OBJECT_SWITCH:
		delete graphicsComponent->getMesh();
		graphicsComponent->setMesh(MeshBuilder::GenerateQuad("Activated", Color(0.f, 0.f, 0.f), 16.f));
		graphicsComponent->getMesh()->textureArray[0] = LoadTGA("Images//Tiles//tile_switch_activate.tga");
		graphicsComponent->getMesh()->alpha = 1.f;
		break;
	case OBJECT_DOOR:
		SoundManager::playSound("Sounds//lever.wav", false);
		SoundManager::playSound("Sounds//opendoor.wav", false);
		currMap->getGridMap()[this->m_iIndexY][this->m_iIndexX]->setremoveDoor(true);
		currMap->getGridMap()[this->m_iIndexY][this->m_iIndexX]->replaceTile(Grid::TILE_FLOOR,BACKGROUND_TILE);
		currMap->getGridMap()[this->m_iIndexY][this->m_iIndexX]->deleteEntity();
		break;
	}
}
コード例 #15
0
ファイル: main.cpp プロジェクト: fkoner/irrmmd
	virtual bool OnEvent(const SEvent& event)
	{
		if (event.EventType == EET_KEY_INPUT_EVENT &&
				event.KeyInput.PressedDown){
			switch(event.KeyInput.Key)
			{
			case 'O':
				device_->getGUIEnvironment()->addFileOpenDialog(
						L"Please select a model file to open");
				break;

			case 27: // ESCAPE
			case 'Q': // fall through
				device_->closeDevice();
				break;

			default:
				std::cout << event.KeyInput.Key << std::endl;
			}
		}
		else if (event.EventType == EET_GUI_EVENT){
			if(event.GUIEvent.EventType==gui::EGET_FILE_SELECTED){
				// load the model file, selected in the file open dialog
				gui::IGUIFileOpenDialog* dialog =
					(gui::IGUIFileOpenDialog*)event.GUIEvent.Caller;
				scene::IAnimatedMesh *m=loadMesh(dialog->getFileName());
				if(m){
					setMesh(m);
				}
			}
		}

		return false;
	}
コード例 #16
0
void Geometry::decode(const std::string& fileName)
{
	//
	setMesh(fileName);
	//
	//setMaterial("shader/aP.fx");
}
コード例 #17
0
DC1dModelling::DC1dModelling(size_t nlayers, const RVector & am, const RVector & bm, const RVector & an, const RVector & bn, 
                              bool verbose)
: ModellingBase(verbose), nlayers_(nlayers), am_(am), an_(an), bm_(bm), bn_(bn){
    init_();
    setMesh(createMesh1DBlock(nlayers));
    k_ = (2.0 * PI) / (1.0 / am_ - 1.0 / an_ - 1.0 / bm_ + 1.0 / bn_);        
    meanrhoa_ = 100.0; //*** hack   
}
コード例 #18
0
void CC3TouchBox::setBox( const CC3Box& aBox )
{
	if ( aBox.isNull() ) {
		setMesh( NULL );
	} else {
		populateBox( aBox );
	}
}
コード例 #19
0
ファイル: Element.cpp プロジェクト: atria-soft/ege
bool ege::Element::loadMesh(const std::string& _meshFileName) {
	ememory::SharedPtr<ege::resource::Mesh> tmpMesh = ege::resource::Mesh::create(_meshFileName);
	if(tmpMesh == nullptr) {
		EGE_ERROR("can not load the resources : " << _meshFileName);
		return false;
	}
	return setMesh(tmpMesh);
}
コード例 #20
0
ファイル: JSVisibleData.cpp プロジェクト: SinSiXX/sirikata
void JSRestoredVisibleData::updateFrom(const IPresencePropertiesRead& orig) {
    setLocation(orig.location());
    setOrientation(orig.orientation());
    setBounds(orig.bounds());
    setMesh(orig.mesh());
    setPhysics(orig.physics());

}
コード例 #21
0
/** Changes this item to be a new type for a certain amount of time.
 *  \param type New type of this item.
 *  \param mesh Mesh to use to display this item.
 */
void Item::switchTo(ItemType type, scene::IMesh *mesh, scene::IMesh *lowmesh)
{
    // triggers and easter eggs should not be switched
    if (m_type == ITEM_TRIGGER || m_type == ITEM_EASTER_EGG) return;

    m_original_type = m_type;
    setMesh(mesh, lowmesh);
    setType(type);
}   // switchTo
コード例 #22
0
		//! constructor
		CInstancedMeshSceneNode::CInstancedMeshSceneNode(IMesh* mesh, ISceneNode* parent, ISceneManager* mgr, s32 id,
			const core::vector3df& position, const core::vector3df& rotation, const core::vector3df& scale)
			: IInstancedMeshSceneNode(parent, mgr, id, position, rotation, scale),
			baseMesh(NULL), readOnlyMaterial(false), staticInstances(false)
		{
#ifdef _DEBUG
			setDebugName("CInstancedMeshSceneNode");
#endif
			setMesh(mesh);
		}
コード例 #23
0
ファイル: StlFile.cpp プロジェクト: doughodson/ogre-examples
 void StlFile::loadImpl()
 {
	 if(Ogre::MeshManager::getSingleton().resourceExists(this->mName)) {
		 setMesh(Ogre::MeshManager::getSingleton().getByName(this->mName));
	 }
	 else {
		 StlFileSerializer serializer;
		 Ogre::DataStreamPtr stream = Ogre::ResourceGroupManager::getSingleton().openResource(mName, mGroup, true, this);
		 serializer.importStlFile(stream, this);
	 }
 }
コード例 #24
0
DC1dModelling::DC1dModelling(size_t nlayers, const RVector & ab2, const RVector & mn2, bool verbose)
: ModellingBase(verbose), nlayers_(nlayers){
    init_();
    setMesh(createMesh1DBlock(nlayers));
    am_ = ab2 - mn2;
    an_ = ab2 + mn2;
    bm_ = ab2 + mn2;
    bn_ = ab2 - mn2;
    k_ = (2.0 * PI) / (1.0 / am_ - 1.0 / an_ - 1.0 / bm_ + 1.0 / bn_); 
    meanrhoa_ = 100.0; //*** hack   
}
コード例 #25
0
ファイル: Ship.cpp プロジェクト: lbarnabas88/3DBattleships
Ship* Ship::_clone(Ship *s, int _id) {
	setName(s->getName());
	setX(s->getX());
	setY(s->getY());
	setZ(s->getZ());
	setMesh(s->getMesh());
	setStructure(s->getStructure());
	id = _id;
	setType(s->getType());
	return this;
}
コード例 #26
0
Albany::PUMIMeshStruct::~PUMIMeshStruct()
{
  setMesh(0);
  if (model)
    gmi_destroy(model);
  PCU_Comm_Free();
#ifdef SCOREC_SIMMODEL
  gmi_sim_stop();
  Sim_unregisterAllKeys();
#endif
}
コード例 #27
0
void SubdividerState::keyDown(int key, int scancode, int mods) {
    if (key == 'C')
        getApp()->toggleCursorCaptured();
    else if (key == 'M') {
        currentMeshNum = (currentMeshNum + 1) % availableMeshes.size();
        setMesh(availableMeshes[currentMeshNum]);
    }
    else if (key == 'L') {
        toggleDrawMode();
    }
    else if (key == 'S') {
        jobPool.emplaceJob([=] () {
            this->mesh.subdivide();
            this->mesh.writeMeshToFile("resources/tmp/subdiv.obj");
            this->getResourceManager()->loadModel("subdivModel",
             "resources/tmp/subdiv.obj", false, false);
        }, [=] () {
            this->mesh.setModel(this->getResourceManager()
             ->getModel("subdivModel"));
        });
    }
    else if (key == 'R') {
        mesh.setToMeshFile(meshFileName);
        this->mesh.writeMeshToFile("resources/tmp/subdiv.obj");
        this->getResourceManager()->loadModel("subdivModel",
         "resources/tmp/subdiv.obj", false, false);
        this->mesh.setModel(this->getResourceManager()->getModel("subdivModel"));
    }
    else if (key == 'N') {
        mesh.cycleToNextType();
        mesh.setToMeshFile(meshFileName);
        this->mesh.writeMeshToFile("resources/tmp/subdiv.obj");
        this->getResourceManager()->loadModel("subdivModel",
         "resources/tmp/subdiv.obj", false, false);
        this->mesh.setModel(this->getResourceManager()->getModel("subdivModel"));
    }
    else if (key == GLFW_KEY_UP) {
        objectScales += 0.05f;
    }
    else if (key == GLFW_KEY_DOWN) {
        objectScales = std::fmax(0.05, objectScales - 0.05f);
    }
    else if (key == GLFW_KEY_RIGHT) {
        objectSpacingFromOrigin += 0.1f * kRightDir;
    }
    else if (key == GLFW_KEY_LEFT) {
        if ((objectSpacingFromOrigin - 0.1f * kRightDir).norm() > 0.1f)
            objectSpacingFromOrigin -= 0.1f * kRightDir;
    }
    else if (key == 'H') {
        drawHUD = !drawHUD;
    }
}
コード例 #28
0
ファイル: Coin.cpp プロジェクト: mattrudder/AckZombies
/**
* CCoin::collided()
* @date Modified April 23, 2006
*/
void CCoin::setValue(ECoinTypes eValue)
{
	m_unValue = eValue;

	// set the mesh based on the value of the coin
	switch(eValue)
	{
	case COPPER_VALUE:
		setMesh((CMesh*)CResourceManager::getInstance().loadResource(RES_MESH, "bronzecoin.x"));
		setScale(D3DXVECTOR3(0.15f,0.15f,0.15f));
		break;
	case SILVER_VALUE:
		setMesh((CMesh*)CResourceManager::getInstance().loadResource(RES_MESH, "silvercoin.x"));
		setScale(D3DXVECTOR3(0.15f,0.15f,0.15f));
		break;
	case GOLD_VALUE:
		setMesh((CMesh*)CResourceManager::getInstance().loadResource(RES_MESH, "goldcoin.x"));
		setScale(D3DXVECTOR3(0.15f,0.15f,0.15f));
		break;
	}
}
コード例 #29
0
//! constructor
CMeshSceneNode::CMeshSceneNode(IMesh* mesh, ISceneNode* parent, ISceneManager* mgr, s32 id,
			const core::vector3df& position, const core::vector3df& rotation,
			const core::vector3df& scale)
: IMeshSceneNode(parent, mgr, id, position, rotation, scale), Mesh(0), Shadow(0),
	PassCount(0), ReadOnlyMaterials(false)
{
	#ifdef _DEBUG
	setDebugName("CMeshSceneNode");
	#endif

	setMesh(mesh);
}
コード例 #30
0
std::shared_ptr<Tile> TileBuilder::build(TileID _tileID, const TileData& _tileData, const TileSource& _source) {

    m_selectionFeatures.clear();

    auto tile = std::make_shared<Tile>(_tileID, *m_scene->mapProjection(), &_source);

    tile->initGeometry(m_scene->styles().size());

    m_styleContext.setKeywordZoom(_tileID.s);

    for (auto& builder : m_styleBuilder) {
        if (builder.second)
            builder.second->setup(*tile);
    }

    for (const auto& datalayer : m_scene->layers()) {

        if (datalayer.source() != _source.name()) { continue; }

        for (const auto& collection : _tileData.layers) {

            if (!collection.name.empty()) {
                const auto& dlc = datalayer.collections();
                bool layerContainsCollection =
                    std::find(dlc.begin(), dlc.end(), collection.name) != dlc.end();

                if (!layerContainsCollection) { continue; }
            }

            for (const auto& feat : collection.features) {
                applyStyling(feat, datalayer);
            }
        }
    }

    for (auto& builder : m_styleBuilder) {

        builder.second->addLayoutItems(m_labelLayout);
    }

    float tileSize = m_scene->mapProjection()->TileSize() * m_scene->pixelScale();

    m_labelLayout.process(_tileID, tile->getInverseScale(), tileSize);

    for (auto& builder : m_styleBuilder) {
        tile->setMesh(builder.second->style(), builder.second->build());
    }

    tile->setSelectionFeatures(m_selectionFeatures);

    return tile;
}