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


C++ PointLight::getColor方法代码示例

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


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

示例1: loadTheme

bool LevelThemeLoader::loadTheme( char* themePath, ID3D11Device* device, WorldGenerator* worldGen, WorldDisplay* worldDisplay )
{
    std::ifstream file( themePath );
    char buffer[128];

    if( !file.is_open() ){
        LOG_ERRO << "Failed to open theme: " << themePath << LOG_ENDL; 
        return false;
    }

    WCHAR wallTexturePath[128];
    WCHAR floorTexturePath[128];
    WCHAR ceilingTexturePath[128];
    Fog fog;
    float wallTextureClip = 1.0f;
    float floorTextureClip = 1.0f;
    float ceilingTextureClip = 1.0f;
    float objectDrawDistance = 1.0f;
    float lightDrawDistance = 1.0f;
    float characterDrawDistance = 1.0f;

    PointLight candle;
    PointLight torch;
    PointLight chandelier;

    while( !file.eof() ){
        file.getline( buffer, 128 );

        //Allow Comments
        for(int i = 0; i < strlen(buffer); i++){
            if( buffer[i] == '#'){
                buffer[i] = '\0';
                break;
            }
        }

        //Blank lines should be skipped
        if( strlen( buffer ) == 0 ){
            continue;
        }

        char* setting = strtok(buffer, " ");
        char* equals = strtok(NULL, " ");
        char* value = strtok(NULL, " ");

        if( strcmp( setting, "WallTexture" ) == 0 ){
            wsprintf(wallTexturePath, L"content/textures/");
            mbstowcs(wallTexturePath + 17, value, 128);
        }else if( strcmp( setting, "WallClip" ) == 0  ){
            wallTextureClip = static_cast<float>(atof( value ));
        }else if( strcmp( setting, "FloorTexture" ) == 0  ){
            wsprintf(floorTexturePath, L"content/textures/");
            mbstowcs(floorTexturePath + 17, value, 128);
        }else if( strcmp( setting, "FloorClip" ) == 0  ){
            floorTextureClip = static_cast<float>(atof( value ));
        }else if( strcmp( setting, "CeilingTexture" ) == 0  ){
            wsprintf(ceilingTexturePath, L"content/textures/");
            mbstowcs(ceilingTexturePath + 17, value, 128);
        }else if( strcmp( setting, "CeilingClip" ) == 0  ){
            ceilingTextureClip = static_cast<float>(atof( value ));
        }else if( strcmp( setting, "FogStart" ) == 0  ){
            fog.start = static_cast<float>(atof( value ));
        }else if( strcmp( setting, "FogEnd" ) == 0  ){
            fog.end = static_cast<float>(atof( value ));
        }else if( strcmp( setting, "FogColorRed" ) == 0  ){
            fog.color.x = static_cast<float>(atof( value ));
        }else if( strcmp( setting, "FogColorGreen" ) == 0  ){
            fog.color.y = static_cast<float>(atof( value ));
        }else if( strcmp( setting, "FogColorBlue" ) == 0  ){
            fog.color.z = static_cast<float>(atof( value ));
        }else if( strcmp( setting, "ObjectDrawDistance" ) == 0  ){
            objectDrawDistance = static_cast<float>(atof( value ));
        }else if( strcmp( setting, "LightDrawDistance" ) == 0  ){
            lightDrawDistance = static_cast<float>(atof( value ));
        }else if( strcmp( setting, "CharacterDrawDistance" ) == 0  ){
            characterDrawDistance = static_cast<float>(atof( value ));
        }else if( strcmp( setting, "CandleRadius" ) == 0  ){
            candle.set( static_cast<float>(atof( value ) ), candle.getIntensity(), candle.getColor() );
        }else if( strcmp( setting, "CandleIntensity" ) == 0  ){
            candle.set( candle.getRadius(), static_cast<float>(atof( value ) ), candle.getColor() );
        }else if( strcmp( setting, "CandleColorRed" ) == 0  ){
            candle.getColor().x = static_cast<float>(atof( value ));
        }else if( strcmp( setting, "CandleColorGreen" ) == 0  ){
            candle.getColor().y = static_cast<float>(atof( value ));
        }else if( strcmp( setting, "CandleColorBlue" ) == 0  ){
            candle.getColor().z = static_cast<float>(atof( value ));
        }else if( strcmp( setting, "TorchRadius" ) == 0  ){
            torch.set( static_cast<float>(atof( value ) ), torch.getIntensity(), torch.getColor() );
        }else if( strcmp( setting, "TorchIntensity" ) == 0  ){
            torch.set( torch.getRadius(), static_cast<float>(atof( value ) ), torch.getColor() );
        }else if( strcmp( setting, "TorchColorRed" ) == 0  ){
            torch.getColor().x = static_cast<float>(atof( value ));
        }else if( strcmp( setting, "TorchColorGreen" ) == 0  ){
            torch.getColor().y = static_cast<float>(atof( value ));
        }else if( strcmp( setting, "TorchColorBlue" ) == 0  ){
            torch.getColor().z = static_cast<float>(atof( value ));
        }else{
            LOG_ERRO << "Unknown Theme Configuration Setting: " << setting << LOG_ENDL;
        }
    }
//.........这里部分代码省略.........
开发者ID:justy989,项目名称:MultiFall,代码行数:101,代码来源:LevelThemeLoader.cpp


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