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


C++ LightList::push_back方法代码示例

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


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

示例1: setupLights

void setupLights() {
	Obj.ambientIntensity = 1.0f;
	Obj.ambientColor = vec3(0.2,0.2,0.2);
	light3 l;
	l.on = true;
	l.orient = vecMath::Normalize(vec3(1.0f,0.0f,0.2f));
	l.origin = vec3(0.0,1.0,0.0);
	l.color = vec3(1.0,0.0,0.0);
	Lights.push_back(l);
	
	l.on = true;
	l.orient = vecMath::Normalize(vec3(0.0f,1.0f,0.2f));
	l.origin = vec3(0.0,-1.333,0.0);
	l.color = vec3(0.0,1.0,0.0);
	Lights.push_back(l);

	l.on = true;
	l.orient = vecMath::Normalize(vec3(1.0f,1.0f,0.2f));
	l.origin = vec3(1.5,1.5,0.0);
	l.color = vec3(0.0,0.0,1.0);
	Lights.push_back(l);


}
开发者ID:rhoem1,项目名称:3dspace,代码行数:24,代码来源:main.cpp

示例2: LoadLight

void LoadLight(TiXmlElement *element)
{
    Light *light = NULL;
    
    // name
    const char* name = element->Attribute("name");
    printf("Light [");
    if ( name ) printf("%s",name);
    printf("]");
    
    // type
    const char* type = element->Attribute("type");
    if ( type ) {
        if ( COMPARE(type,"ambient") ) {
            printf(" - Ambient\n");
            AmbientLight *l = new AmbientLight();
            light = l;
            for ( TiXmlElement *child = element->FirstChildElement(); child!=NULL; child = child->NextSiblingElement() ) {
                if ( COMPARE( child->Value(), "intensity" ) ) {
                    Color c(1,1,1);
                    ReadColor( child, c );
                    l->SetIntensity(c);
                    printf("   intensity %f %f %f\n",c.r,c.g,c.b);
                }
            }
        } else if ( COMPARE(type,"direct") ) {
            printf(" - Direct\n");
            DirectLight *l = new DirectLight();
            light = l;
            for ( TiXmlElement *child = element->FirstChildElement(); child!=NULL; child = child->NextSiblingElement() ) {
                if ( COMPARE( child->Value(), "intensity" ) ) {
                    Color c(1,1,1);
                    ReadColor( child, c );
                    l->SetIntensity(c);
                    printf("   intensity %f %f %f\n",c.r,c.g,c.b);
                } else if ( COMPARE( child->Value(), "direction" ) ) {
                    Point3 v(1,1,1);
                    ReadVector( child, v );
                    l->SetDirection(v);
                    printf("   direction %f %f %f\n",v.x,v.y,v.z);
                }
            }
        } else if ( COMPARE(type,"point") ) {
            printf(" - Point\n");
            PointLight *l = new PointLight();
            light = l;
            for ( TiXmlElement *child = element->FirstChildElement(); child!=NULL; child = child->NextSiblingElement() ) {
                if ( COMPARE( child->Value(), "intensity" ) ) {
                    Color c(1,1,1);
                    ReadColor( child, c );
                    l->SetIntensity(c);
                    printf("   intensity %f %f %f\n",c.r,c.g,c.b);
                } else if ( COMPARE( child->Value(), "position" ) ) {
                    Point3 v(0,0,0);
                    ReadVector( child, v );
                    l->SetPosition(v);
                    printf("   position %f %f %f\n",v.x,v.y,v.z);
                }
            }
        } else {
            printf(" - UNKNOWN\n");
        }
    }
    
    if ( light ) {
        light->SetName(name);
        lights.push_back(light);
    }
    
}
开发者ID:varunk08,项目名称:raytracing,代码行数:70,代码来源:xmlload.cpp


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