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


C++ Quad::init方法代码示例

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


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

示例1: init

void init(){
    ///--- Sets background color
    glClearColor(/*gray*/ .937,.937,.937, /*solid*/1.0 );
    
    triangle.init();
    quad.init();
}
开发者ID:4444jw4444,项目名称:Ray-Tracer-Scene-Renderer,代码行数:7,代码来源:main.cpp

示例2: insertPoints

    void insertPoints(const Point* points_begin, const Point* points_end) {
        const auto pointCount = points_end - points_begin;

        pointRegion.alloc(pointCount);

        const auto quadCount = 1 + (pointCount / Quad::MAX_LEAF_POINTS + 1) * 4;
        quadRegion.alloc(quadCount);
        quad = quadRegion.next();
        quad->init(0);

        auto my_points = pointRegion.next();
        memcpy(my_points, points_begin, pointCount * sizeof(Point));

        quad->insertPoints(quadRegion, my_points, my_points + pointCount);
    }
开发者ID:huangfeidian,项目名称:challenge1,代码行数:15,代码来源:dllmain.cpp

示例3: initApp

void ColoredCubeApp::initApp()
{
	D3DApp::initApp();
	
	line1.init(md3dDevice, 10.0f, GREEN);
	line2.init(md3dDevice, 10.0f, BLUE);
	line3.init(md3dDevice, 10.0f, RED);

	xLine.init(&line1, Vector3(0,0,0), 5);
	xLine.setPosition(Vector3(0,0,0));
	yLine.init(&line2, Vector3(0,0,0), 5);
	yLine.setPosition(Vector3(0,0,0));
	yLine.setRotationZ(ToRadian(90));
	zLine.init(&line3, Vector3(0,0,0), 5);
	zLine.setPosition(Vector3(0,0,0));
	zLine.setRotationY(ToRadian(90));

	quad1.init(md3dDevice, 50, CYAN);
	quad1.setPosition(Vector3(0,-5,0));

	quad2.init(md3dDevice, 50, RED);
	quad2.setPosition(Vector3(0,5,0));

	quad3.init(md3dDevice, 50, BEACH_SAND);
	quad3.setPosition(Vector3(5,5,0));
	quad3.setRotXAngle(ToRadian(90));
	quad3.setRotYAngle(ToRadian(90));

	quad4.init(md3dDevice, 50, BEACH_SAND);
	quad4.setPosition(Vector3(-5,5,0));
	quad4.setRotXAngle(ToRadian(90));
	quad4.setRotYAngle(ToRadian(90));

	quad4.init(md3dDevice, 50, BEACH_SAND);
	quad4.setPosition(Vector3(-5,5,0));
	quad4.setRotXAngle(ToRadian(90));

	quad5.init(md3dDevice, 50, DARKBROWN);
	quad5.setPosition(Vector3(0,0,-7));
	quad5.setRotXAngle(ToRadian(90));

	for(int i = 0; i < WALL_SIZE; ++i) {
		wall[i].init(md3dDevice, 1, GREEN);
		wall[i].setPosition(Vector3((rand() % MAX_RADIUS) - (MAX_RADIUS / 2), (rand() % MAX_RADIUS) - (MAX_RADIUS / 2), -6));
		wall[i].setRotXAngle(ToRadian(90));
		wall[i].setRotZAngle(ToRadian(45));
	}

	buildFX();
	buildVertexLayouts();

}
开发者ID:,项目名称:,代码行数:52,代码来源:

示例4: initApp

void CubeMapApp::initApp()
{
	D3DApp::initApp();

	fx::InitAll(md3dDevice);
	InputLayout::InitAll(md3dDevice);
	GetTextureMgr().init(md3dDevice);


	mTech                = fx::CubeMapFX->GetTechniqueByName("CubeMapTech");
	mfxLightVar          = fx::CubeMapFX->GetVariableByName("gLight");
	mfxEyePosVar         = fx::CubeMapFX->GetVariableByName("gEyePosW");
	mfxWVPVar            = fx::CubeMapFX->GetVariableByName("gWVP")->AsMatrix();
	mfxWorldVar          = fx::CubeMapFX->GetVariableByName("gWorld")->AsMatrix();
	mfxTexMtxVar         = fx::CubeMapFX->GetVariableByName("gTexMtx")->AsMatrix();
	mfxReflectMtrlVar    = fx::CubeMapFX->GetVariableByName("gReflectMtrl")->AsVector();
	mfxCubeMapEnabledVar = fx::CubeMapFX->GetVariableByName("gCubeMapEnabled")->AsScalar();
	mfxDiffuseMapVar     = fx::CubeMapFX->GetVariableByName("gDiffuseMap")->AsShaderResource();
	mfxSpecMapVar        = fx::CubeMapFX->GetVariableByName("gSpecMap")->AsShaderResource();
	mfxCubeMapVar        = fx::CubeMapFX->GetVariableByName("gCubeMap")->AsShaderResource();

 
	//mClearColor = D3DXCOLOR(0.0f, 0.0f, 0.0f, 1.0f);

	GetCamera().position() = D3DXVECTOR3(0.0f, 1.8f, -10.0f);

	mBallMapRV        = GetTextureMgr().createTex(L"blackdiffuse.dds");
	//mSpecMapRV        = GetTextureMgr().createTex(L"spec.dds");
	mDefaultSpecMapRV = GetTextureMgr().createTex(L"defaultspec.dds");
	mEnvMapRV         = GetTextureMgr().createCubeTex(L"grassenvmap1024.dds");

	mFloor.init(md3dDevice, 41, 21, 1.0f);
	mBase.init(md3dDevice, 2.0f);
	mBall.init(md3dDevice, 0.5f, 30, 30);
	mColumn.init(md3dDevice, 0.25f, 1.0f, 3.0f, 30, 30);
	mSky.init(md3dDevice, mEnvMapRV, 5000.0f);

 
	mParallelLight.dir      = D3DXVECTOR3(0.57735f, -0.57735f, 0.57735f);
	mParallelLight.ambient  = D3DXCOLOR(0.3f, 0.3f, 0.3f, 1.0f);
	mParallelLight.diffuse  = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f);
	mParallelLight.specular = D3DXCOLOR(0.5f, 0.5f, 0.5f, 1.0f);
}
开发者ID:Team306,项目名称:BigProject,代码行数:43,代码来源:main.cpp

示例5: initApp

void ColoredCubeApp::initApp()
{

    D3DApp::initApp();
    //input->initialize(getMainWnd(), false);
    //audio->initialize();

    float boxScale = 0.5f;
    float collisionFixFactor = 1.1f;
    currentBullet = 0;
    explosionTimer = 0;
    explosionRunning = false;
    shotRelease = true;

    // increments when you run into a cube // just for now
    score = 0;
    mAxes.init(md3dDevice, 1.0f);
    mEnemy.init(md3dDevice, .5f, RED);
    mPlayer.init(md3dDevice, .5f, BLUE);
    mBullet.init(md3dDevice, .25f, D3DXCOLOR(0.0f, 1.0f, 0.0f, 0.0f));
    particleBox.init(md3dDevice, .01f, GREEN);
    particleBox2.init(md3dDevice, .04f, RED);
    starBox.init(md3dDevice, 0.05f, WHITE);
    //mBox.init(md3dDevice, boxScale);
    mLine.init(md3dDevice, 1.0f);
    //mTriangle.init(md3dDevice, 1.0f);
    //mQuad.init(md3dDevice, 10.0f);
    mQuad.init(md3dDevice, 0.0f);

    gameObject1.init(&mPlayer, sqrt(2.0f), Vector3(6,.5,0), Vector3(0,0,0), 5.0f,1.0f);
    //gameObject1.init(&mBox, sqrt(2.0f), Vector3(6,.5,0), Vector3(0,0,0), 5000.0f,1.0f);
    gameObject1.setRadius(gameObject1.getRadius()*boxScale*collisionFixFactor);

    int step = 2;
    for (int i = 0; i < MAX_NUM_ENEMIES; i++)
    {
        enemyObjects[i].init(&mEnemy, sqrt(2.0), Vector3(-5,.5,step*i - 3.8), Vector3(1,0,0), 8.0f, 1);
        //enemyObjects[i].init(&mBox, sqrt(2.0), Vector3(-5,.5,step*i - 3.8), Vector3(1,0,0), 3000.0f, 1);
        enemyObjects[i].setRadius(enemyObjects[i].getRadius()*boxScale * collisionFixFactor);
        enemyObjects[i].setInActive();
    }

    for (int i = 0; i < MAX_NUM_BULLETS; i++)
    {
        playerBullets[i].init(&mBullet, 0.5f, Vector3(0,0,0), Vector3(-12,0,0), 0.0f, 1);
        playerBullets[i].setInActive();
    }

    for (int i = 0; i < MAX_NUM_EXP_PARTICLES; i++)
    {

        if(i%5 == 0)particles[i].init(&particleBox2, 0.5f, Vector3(0,0,0), Vector3(0,0,0), 7000.0f, 1);
        else particles[i].init(&particleBox, 0.5f, Vector3(0,0,0), Vector3(0,0,0), 7000.0f, 1);
        particles[i].setInActive();
    }

    for (int i = 0; i < MAX_NUM_STARS; i++)
    {
        stars[i].init(&starBox, 0.5f, Vector3(0,0,0), Vector3(0,0,0), 7000.0f, 1);
        stars[i].setActive();
    }

    buildFX();
    buildVertexLayouts();

    audio = new Audio();

    if (*WAVE_BANK != '\0' && *SOUND_BANK != '\0')  // if sound files defined
    {
        if (!audio->initialize()) {

        }

        /*if( FAILED( hr = audio->initialize() ) )
        {
        if( hr == HRESULT_FROM_WIN32( ERROR_FILE_NOT_FOUND ) )
        throw(GameError(gameErrorNS::FATAL_ERROR, "Failed to initialize sound system because media file not found."));
        else
        throw(GameError(gameErrorNS::FATAL_ERROR, "Failed to initialize sound system."));
        }*/
    }

    enemyBuffer.resetClock();
    shotBuffer.resetClock();
    gameTimer.resetClock();


    D3DXVECTOR3 pos(10.0f, 2.0f, 0.0f);
    D3DXVECTOR3 target(0.0f, 0.0f, 0.0f);
    D3DXVECTOR3 up(0.0f, 1.0f, 0.0f);

    //Camera Object
    camera.init(pos, Vector3(0,0,0), Vector3(0,0,0));
    camera.setPerspective();
    // camera
    cameraPos = pos;

    audio->playCue(BKG);

    //Places stars in scene
//.........这里部分代码省略.........
开发者ID:SamGill,项目名称:Games2-Proj1,代码行数:101,代码来源:Colored+Cube+App.cpp


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