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


C++ TestScene::AddRenderableThing方法代码示例

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


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

示例1: WinMain


//.........这里部分代码省略.........
    //sky->Init("textures/", "skymap.dds");
    sky->Init("textures/", "Above_The_Sea.dds");
    //sky->Init("textures/", "desert_skymap.dds");
    scene->AddSky(sky);

    Terrain *terrain = new Terrain;
    //terrain->Init("terrain/testHight.bmp", "terrain/", "dirt01.dds");
    terrain->Init("terrain/heightmap01.bmp", "terrain/", "grass.jpg");
    scene->AddTerrain(terrain);

    Wall *wall = new Wall;
    wall->Init(30, 30, 0.3);
    wall->Pitch(XM_PI / 2);
    wall->SetPosition(0, -3, 0);
    //scene->AddRenderableThing(*wall);

    //¿É¼ûÐÔ²âÊÔ
    Wall *wall0 = new Wall;
    wall0->Init(30, 30, 0.3);
    wall0->Pitch(XM_PI / 2);
    wall0->SetPosition(1000, -3, 0);
    //scene->AddRenderableThing(*wall0);

    Obj *obj = new Obj;
    obj->CreateBox(1, 3, 2, material);
    obj->SetPosition(5, 1, 12);
    obj->Yaw(XM_PI / 3);
    obj->Roll(XM_PI / 3);
    obj->SetScale(1.3);
    //scene->AddRenderableThing(*obj);

    Cube *cube = new Cube;
    cube->Init(2);
    cube->Pitch(XM_PI / 3);
    cube->Roll(XM_PI / 3);
    cube->SetMaterial(material);
    //scene->AddRenderableThing(*cube);

    Ball *ball = new Ball;
    ball->Init(1);
    ball->SetPosition(0, 0, 6);

    Obj *objInWall = new Obj;
    objInWall->CreateBox(1, 1, 1, material);
    objInWall->SetPosition(0, 1, 0);
    ball->AddChild(objInWall);

    //scene->AddRenderableThing(*ball);
    

    Ship *ship = new Ship;
    //ship->Init();
    //ship->SetPosition(-10, 0, 0);
    //scene->AddRenderableThing(*ship);

    Model *test = new Model;
    test->LoadModel("media/", "chair.obj");
    test->SetScale(1.7);
    test->SetPosition(-15, 0, 0);
    test->Pitch(-1.2);
    test->Yaw(-1.5);
    //scene->AddRenderableThing(*test);


    //SmileBoy *smileBoy= new SmileBoy;
    //smileBoy->Init();
    //smileBoy->SetHandleInput(FALSE);
    //scene->AddRenderableThing(*smileBoy);

    Female *female = new Female;
    female->Init();
    //female->SetPosition(-7, 0,0);
    female->SetHandleInput(TRUE);
    scene->AddRenderableThing(*female);

    RenderSystem::GetInstance()->SetShadowOpen(true);
    engine->LoadScene(scene);


    {
        Light *light = new Light;
        light->type = 0;
        light->position = XMFLOAT4(0.0f, 5.0f, -5.0f, 1.0f);
        XMStoreFloat4(&light->direction, XMVector4Normalize(XMVectorSet(1.0f, -1.0f, 0.0f, 0.0f)));
        light->ambient = XMFLOAT4(0.4f, 0.2f, 0.3f, 1.0f);
        light->diffuse = XMFLOAT4(0.3f, 0.4f, 0.5f, 1.0f);
        light->specular = XMFLOAT4(0.5f, 0.3f, 0.2f, 1.0f);
        light->attenuation0 = 0.0f;
        light->attenuation1 = 0.0f;
        light->attenuation2 = 0.0f;
        light->alpha = 0.0f;
        light->beta = 0.0f;
        light->falloff = 0.0f;
        scene->AddLight(light);
    }
    //*******************************************
    engine->Run();

    return 0; 
}
开发者ID:whztt07,项目名称:XEngine,代码行数:101,代码来源:main.cpp


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