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


C++ Sphere::loadTexture方法代码示例

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


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

示例1: onInitialize


//.........这里部分代码省略.........
		cp->addToDynamicWorld(m_dynamicsWorld);
		m_graph->attach(cp);
        cp->attachParticleSystem(new WaypointParticleSystem(200));
        
		// create a platform
		Platform *platform = new Platform(this, Vector3(50.0f, 1.0f, 12.0f));
		if ( !platform->initialize(new LightShader(0.2f, 0.8f, 8, RAND_COLOR))) { GLOG("ERROR: Could not initialize gap platform\n"); return false; }
		platform->setPosition(nodeCenter + Vector3(25.0f, -0.5f, 0.0f));
		platform->addToDynamicWorld(m_dynamicsWorld);
		m_graph->attach(platform);
        
        // cube pyramid right before gap
        m_graph->pushNode();
		Vector3 cubeSize = Vector3(1.5f, 1.5f, 0.5f);
		Vector3 startPoint = nodeCenter + Vector3(49.0f, cubeSize.y / 2.0f, -5.0f);
		CubeGroups::createCubePyramid(this, 7, startPoint, cubeSize, 0.1f, 90.0f);
		m_graph->popNode();
        
        // create a second platform after gap
		platform = new Platform(this, Vector3(20.0f, 1.0f, 10.0f));
		if ( !platform->initialize(new LightShader(0.2f, 0.8f, 8, RAND_COLOR))) { GLOG("ERROR: Could not initialize 2nd gap platform\n"); return false; }
		platform->setPosition(nodeCenter + Vector3(65.0f, -0.5f, 0.0f));
		platform->addToDynamicWorld(m_dynamicsWorld);
		m_graph->attach(platform);
    }
	m_graph->popNode();
    
    
    // create a conveyor to take player up to next section
    Conveyor *conveyor1 = new Conveyor(this, Vector3(10.0f, 1.0f, 80.0f), 2.5f );
    if ( !conveyor1->initialize(new LightTexScrollShader(0.3f, 1.0f, 4, Color(1.0f, 1.0f, 1.0f), Vector3(0.0f, -1.0f, 0.0f), conveyor1->getSpeed() * 0.5f, 3.0f))) { GLOG("ERROR: Could not initialize conveyor1\n"); return false; }
    conveyor1->setPosition(nodeCenter + Vector3(85.0f, 2.0f, -35.0f));
    conveyor1->setOrientation(180.0f, 5.0f, 0.0f);
    conveyor1->loadTexture("Textures/conveyor.tga");
    conveyor1->addToDynamicWorld(m_dynamicsWorld);
    m_graph->attach(conveyor1);
    
    
    //-----------------------------------------------------------------
	// create seemingly random small platform that user has to jump between
	//-----------------------------------------------------------------
	m_graph->pushNode();
	{
        nodeCenter += Vector3(85.0f, 5.0f, -85.0f);
        
        float lastZ = 0.0f;
        for (int i = 0; i < 20; i++) {
            Vector3 position = Vector3(-10.0f + RANDF(20.0f), -2.0f + RANDF(4.0f), lastZ - (5.0f + RANDF(5.0f)));
            
            Platform *platform = new Platform(this, Vector3(4.0f + RANDF(5.0f), 1.0f + RANDF(2.0f), 4.0f + RANDF(5.0f)));
            if ( !platform->initialize(new LightShader(0.3f, 0.8f, 8, RAND_COLOR))) { GLOG("ERROR: Could not initialize sparse platform\n"); return false; }
            platform->setPosition(nodeCenter + position);
            platform->addToDynamicWorld(m_dynamicsWorld);
            m_graph->attach(platform);
            
            lastZ = position.z - platform->getSize().z * 0.5f;
        }
        
        nodeCenter.z += lastZ - 10.0f;
        
        // larger platform at the end of the small platforms
        Platform *platform = new Platform(this, Vector3(15.0f, 1.0f, 15.0f));
        if ( !platform->initialize(new LightShader(0.3f, 0.8f, 8, RAND_COLOR))) { GLOG("ERROR: Could not initialize post-sparse platform\n"); return false; }
        platform->setPosition(nodeCenter + Vector3(0.0f, 0.0f, 0.0f));
        platform->addToDynamicWorld(m_dynamicsWorld);
        m_graph->attach(platform);
开发者ID:ChuckNice,项目名称:SBU_Sources,代码行数:67,代码来源:nicks_scene.cpp


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