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


C++ LightSource::setPosition方法代码示例

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


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

示例1: init

void init() {

    camera.position[2] = 15;

    libpng_version();

    light0.slot = GL_LIGHT0;
    light0.setDiffuse(1.0, 1.0, 1.0, 1.0);
    light0.setPosition(0.0, 0.0, 1.0, 0.0);
    light0.load();
    light0.enable();

    glewInit();

    loadObj((char*) "models/350z.obj", &mesh);
    VBOfromMesh(vbo, mesh);

    vbo.generate();

    int w, h;
    test_texture = texture_bank.findOrReg((char*) "textures/350z/vinyls.png");
    //test_texture = PNG_load((const char*) "textures/vinyls.png", &w, &h);

    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, test_texture);

    programID = loadShaders("shaders/vertex.glsl", "shaders/fragment.glsl");
    glUseProgram(programID);

    uTex = glGetUniformLocation(programID, "texDiff");
    glUniform1i(uTex, 0);

    uProjection = glGetUniformLocation(programID, "projection");
    uView = glGetUniformLocation(programID, "view");
    uModel = glGetUniformLocation(programID, "model");

    uLightPos = glGetUniformLocation(programID, "lightPos");
    uLightDiff = glGetUniformLocation(programID, "lightDiff");
    uLightSpec = glGetUniformLocation(programID, "lightSpec");

    uCameraPosition = glGetUniformLocation(programID, "cameraPosition");

    glEnable(GL_LIGHTING);
    glEnable(GL_COLOR_MATERIAL);
    glEnable(GL_ALPHA_TEST);
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE);

    glEnable(GL_DEPTH_TEST);
}
开发者ID:Starkus,项目名称:NewHorizon,代码行数:51,代码来源:NewHorizon.cpp

示例2: setFilterEffectAttribute

bool SVGFESpecularLightingElement::setFilterEffectAttribute(FilterEffect* effect, const QualifiedName& attrName)
{
    FESpecularLighting* specularLighting = static_cast<FESpecularLighting*>(effect);

    if (attrName == SVGNames::lighting_colorAttr) {
        RenderObject* renderer = this->renderer();
        ASSERT(renderer);
        ASSERT(renderer->style());
        return specularLighting->setLightingColor(renderer->style()->svgStyle().lightingColor());
    }
    if (attrName == SVGNames::surfaceScaleAttr)
        return specularLighting->setSurfaceScale(m_surfaceScale->currentValue()->value());
    if (attrName == SVGNames::specularConstantAttr)
        return specularLighting->setSpecularConstant(m_specularConstant->currentValue()->value());
    if (attrName == SVGNames::specularExponentAttr)
        return specularLighting->setSpecularExponent(m_specularExponent->currentValue()->value());

    LightSource* lightSource = const_cast<LightSource*>(specularLighting->lightSource());
    SVGFELightElement* lightElement = SVGFELightElement::findLightElement(*this);
    ASSERT(lightSource);
    ASSERT(lightElement);
    ASSERT(effect->filter());

    if (attrName == SVGNames::azimuthAttr)
        return lightSource->setAzimuth(lightElement->azimuth()->currentValue()->value());
    if (attrName == SVGNames::elevationAttr)
        return lightSource->setElevation(lightElement->elevation()->currentValue()->value());
    if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || attrName == SVGNames::zAttr)
        return lightSource->setPosition(effect->filter()->resolve3dPoint(lightElement->position()));
    if (attrName == SVGNames::pointsAtXAttr || attrName == SVGNames::pointsAtYAttr || attrName == SVGNames::pointsAtZAttr)
        return lightSource->setPointsAt(effect->filter()->resolve3dPoint(lightElement->pointsAt()));
    if (attrName == SVGNames::specularExponentAttr)
        return lightSource->setSpecularExponent(lightElement->specularExponent()->currentValue()->value());
    if (attrName == SVGNames::limitingConeAngleAttr)
        return lightSource->setLimitingConeAngle(lightElement->limitingConeAngle()->currentValue()->value());

    ASSERT_NOT_REACHED();
    return false;
}
开发者ID:darktears,项目名称:blink-crosswalk,代码行数:39,代码来源:SVGFESpecularLightingElement.cpp

示例3: init

void GameManager::init()
{
	int quadrante;
	double direction;

	std::srand(std::time(0));


	//Initializing Flags
	wireFlag = false;
	dirLightFlag = false;
	spotLightFlag = false;
	pointLightFlag = false;
	activateLights = false;
	shadeFlag = false;
	pauseFlag = false;
	startFlag = false;


	//Constructing Textures
	//_pauseTex = new Texture("C:\\Users\\DanielaD\\Desktop\\MicroMachines CG\\pause.jpg");
	//_gameOverTex = new Texture("C:\\Users\\DanielaD\\Desktop\\MicroMachines CG\\gameover.jpg");

	_pausePlane = new Plane(0, 0, 10);
	_pausePlane->setFileName("C:\\Users\\DanielaD\\Desktop\\MicroMachines CG\\pause.png");
	_gameOverPlane = new Plane(0, 0, 10);
	_gameOverPlane->setFileName("C:\\Users\\DanielaD\\Desktop\\MicroMachines CG\\rip.png");
	
	//Constructing Objects//
	Table * table = new Table();
	table->setPosition(0, 0, 0);
	//table->setTexture("C:\\Users\\DanielaD\\Desktop\\MicroMachines CG\\wood.png");
	_gameObjects.push_back(table);

	Roadside * roadside = new Roadside();
	roadside->setPosition(0, 0, 0.05);
	_gameObjects.push_back(roadside);


	//criar a posicao de cada cheerio (outer road)
	int angle = 0;
	double x, y;

	while (angle < 360) {
		x = OUTTERLENGTH * cos((angle)*(PI / 180));
		y = OUTTERLENGTH * sin((angle)*(PI / 180));

		Cheerio *cNew = new Cheerio(x, y, 1.6);
		roadside->insertCheerio(cNew);
		_gameObjects.push_back(cNew);
		angle += OUTTER_ANGLE_INCREASE;
	}

	//criar a posicao de cada cheerio (inner road)
	angle = 0;

	while (angle < 360) {
		x = INNERLENGTH * cos((angle)*(PI / 180));
		y = INNERLENGTH * sin((angle)*(PI / 180));

		Cheerio *cNew = new Cheerio(x, y, 1.6);
		roadside->insertCheerio(cNew);
		_gameObjects.push_back(cNew);
		angle += INNER_ANGLE_INCREASE;
	}

	_car = new Car();
	_car->setPosition(-12, 0, 1.7);
	_car->setRight(false);
	_car->setLeft(false);
	_car->setUp(false);
	_car->setDown(false);
	_gameObjects.push_back(_car);

	x = -14, y = -14;
	for (int i = 0; i < _lifes; i++) {
		Car* tempLife = new Car();
		tempLife->setPosition(x, y, 10);
		tempLife->setRight(false);
		tempLife->setLeft(false);
		tempLife->setUp(false);
		tempLife->setDown(false);
		_lifeVector.push_back(tempLife);
		x += 1.5;
	}


	Butter * butter1 = new Butter();
	butter1->setPosition(3, 12, 1.6);
	_gameObjects.push_back(butter1);

	Butter * butter2 = new Butter();
	butter2->setPosition(4, 13, 1.6);
	_gameObjects.push_back(butter2);

	Butter * butter3 = new Butter();
	butter3->setPosition(5, 12, 1.6);
	_gameObjects.push_back(butter3);

	Butter * butter4 = new Butter();
//.........这里部分代码省略.........
开发者ID:Danisodu,项目名称:Computer-Graphics,代码行数:101,代码来源:GameManager.cpp


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