• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ setCamera函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中setCamera函数的典型用法代码示例。如果您正苦于以下问题:C++ setCamera函数的具体用法?C++ setCamera怎么用?C++ setCamera使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: setCamera

void RenderPanel::setViewController( ViewController* controller )
{
  view_controller_ = controller;

  if( view_controller_ )
  {
    setCamera( view_controller_->getCamera() );
    view_controller_->activate();
  }
  else
  {
    setCamera( NULL );
  }
}
开发者ID:jkammerl,项目名称:rviz,代码行数:14,代码来源:render_panel.cpp


示例2: setCamera

//==============================================================================
//
//------------------------------------------------------------------------------
void Camera::setCamera(CameraBace* moveToCamera,int frame) {
  //if(_moveToCamera != nullptr) return;
  if(frame == 0) {
    setCamera(moveToCamera);
    return;
  }

  _moveToCamera = moveToCamera;
  _maxFrame = frame;
  _nowFrame = 0;

  memcpy(_destCamera,_currentCam,sizeof(CameraBace));
  memcpy(_defaultCam,_currentCam,sizeof(CameraBace));
  setCamera(_defaultCam);
}
开发者ID:h406,项目名称:project,代码行数:18,代码来源:camera.cpp


示例3: glClearColor

void Camera::renderCubeMap(VisualizationParameterSet& visParams)
{
  // cube map has only to be build if a reflective object is chosen
  if(!graphicsManager->doEnvRendering())
    return;  

  // set clear color once
  Surface* backgroundSurface = simulation->getBackgroundSurface();
  glClearColor(backgroundSurface->color[0], backgroundSurface->color[1],
      backgroundSurface->color[2], backgroundSurface->color[3]);

  // cube map rendering
  for(int generateCubeMap = 6; generateCubeMap > 0; generateCubeMap--)
  {
    glClear(default_clear);
    graphicsManager->setCubeMapPerspective();
    setCamera(visParams, generateCubeMap);
    graphicsManager->updateLights(true, false, visParams.provideUniforms);
    graphicsManager->renderEnvironment(maxRange);
    // prepare surface properties
    glCallList(graphicsManager->enableStateDL[visParams.surfaceStyle]);
    rootNode->draw(visParams);
    glCallList(graphicsManager->disableStateDL[visParams.surfaceStyle]);
    graphicsManager->revertLightTextureUnits(visParams.provideUniforms);
    glFlush();
    // save image to cubemap file
    graphicsManager->handleCubeMapping(generateCubeMap, simulation->getFilename());
  }
}
开发者ID:alon,项目名称:bhuman2009fork,代码行数:29,代码来源:Camera.cpp


示例4: keyboard

void keyboard(unsigned char k, int x, int y) {
	switch (k) {
	case 27: exit(0);
	}
	setCamera();

}
开发者ID:dknife,项目名称:201502_Graphics,代码行数:7,代码来源:main.cpp


示例5: a

void Camera::rotateCamera(int i){
  float ang = 3.0*i;
  AngleAxis<float> a((ang*M_PI)/180.0, Vector3f::UnitY() );
  Matrix3f m;
  Vector3f v1, v2, v3;
  Vector3f eyeOld;
  float dist;

  eyeOld = eye;

  // Define axis of rotation
  m = AngleAxisf((0.0*M_PI)/180.0, Vector3f::UnitX())
       * AngleAxisf((ang*M_PI)/180.0, Vector3f::UnitY())
       * AngleAxisf((0.0*M_PI)/180.0, Vector3f::UnitZ());

  // Find vector from eye to aim and use as rotation point around origin
  v1 << aim - eye;
  dist = v1.norm();

  // Rotate point and find vector between the original point and the rotated point
  v2 << v1;
  v2 << m * v2;
  v2 << v2 - v1;

  // Apply the difference to the eye
  v3 << eye + v2;
  v3 << v3 - aim;
  v3.normalize();
  eye << dist * v3 + aim;
  eye(1) = eyeOld(1);

  setCamera();
}
开发者ID:jlcox5,项目名称:Frost,代码行数:33,代码来源:camera.cpp


示例6: setCamera

void ::CameraContral::riseCameraTo(float h)
{
	mHeight = h;
	mHeight = (mHeight > 100.0f)? 100.0f: mHeight;
	mHeight = (mHeight < 10.0f)? 10.0f: mHeight;
	setCamera();
}
开发者ID:parhelia512,项目名称:fdux-slg-game,代码行数:7,代码来源:CameraContral.cpp


示例7: extrinsicPath

bool
CameraSystem::readFromDirectory(const std::string& directory)
{
    if (!boost::filesystem::is_directory(directory))
    {
        return false;
    }

    // read extrinsic data
    boost::filesystem::path extrinsicPath(directory);
    extrinsicPath /= "camera_system_extrinsics.txt";

    std::vector<std::string> cameraNames;
    readFromTextFile(extrinsicPath.string(), cameraNames);

    // read intrinsic data
    for (size_t i = 0; i < cameraNames.size(); ++i)
    {
        boost::filesystem::path calibPath(directory);
        calibPath /= cameraNames.at(i) + "_camera_calib.yaml";

        CameraPtr camera = CameraFactory::instance()->generateCameraFromYamlFile(calibPath.string());

        if (!camera)
        {
            return false;
        }

        setCamera(i, camera);
    }

    return true;
}
开发者ID:JayHuangYC,项目名称:vmav-ros-pkg,代码行数:33,代码来源:CameraSystem.cpp


示例8: maxV

void CameraManager::updateCurrent_(float dt) {
    glm::vec3 dx = target_ - current_;
    glm::vec3 maxV(getParam("camera.maxVx"),
                   getParam("camera.maxVy"),
                   getParam("camera.maxVz"));
    // If we're trying to move faster than we're allowed,
    // clip our velocity in that direction.
    if (fabs(dx.x) > maxV.x * dt) {
        dx.x = dx.x < 0 ? 
            -1 * maxV.x * dt : 
                 maxV.x * dt;
    }
    if (fabs(dx.y) > maxV.y * dt) {
        dx.y = dx.y < 0 ? 
            -1 * maxV.y * dt :
                 maxV.y * dt;
    }
    if (fabs(dx.z) > maxV.z * dt)
    {
        dx.z = dx.z < 0 ?
            -1 * maxV.z * dt :
                 maxV.z * dt;
    }

    current_ = current_ + dx;
    setCamera(current_);

}
开发者ID:zackgomez,项目名称:geosmash,代码行数:28,代码来源:CameraManager.cpp


示例9: setCamera

bool BattleScene::init()
{
	Layer::init();
	currentLayer = this;
	Texture2D::setDefaultAlphaPixelFormat(Texture2D::PixelFormat::RGB565);

	setCamera();
	controlCamera();
	setCameraMask(2);
	createBackground();
	enableTouch();
	initUILayer();
	GameMaster::create();

	MessageDispatchCenter::getInstance()->registerMessage(MessageType::BLOOD_MINUS, [](Actor * heroActor)
	{
		uiLayer->bloodDrop(heroActor);
	});
	MessageDispatchCenter::getInstance()->registerMessage(MessageType::ANGRY_CHANGE, [](Actor * heroActor)
	{
		uiLayer->angryChange(heroActor);
	});

	scheduleUpdate();
	return true;
}
开发者ID:WhatTeam,项目名称:FantasyLand,代码行数:26,代码来源:BattleScene.cpp


示例10: cameraOrbit

/* Function: cameraOrbit
 * Description: Rotates the entire camera about a point using the mouse.
 * Input: x - X Coordinate of the mouse
 *        y - Y Coordinate of the mouse	
 * Output: None
 */
void cameraOrbit(int x, int y)
{
	point mouse;

	mouse.x = x - mousePos.x;
	mouse.y = y - mousePos.y;

	Phi += mouse.x * 0.01;
	Theta += mouse.y * 0.01;
    
    if (Phi > (2 * PI))
		Phi -= 2 * PI;
    
    if (Phi < 0)
		Phi += 2 * PI;
    
    if (Theta > (PI / 2 - 0.01)) // dont let the point enter the north pole
		Theta = PI / 2 - 0.01;
    
    if (Theta < (-PI / 2 + 0.01))
		Theta = -PI / 2 + 0.01;

	// Recompute camera position
	cameraPos.x = lineOfSight.x + (R * cos(Phi) * cos(Theta));
	cameraPos.y = lineOfSight.y + (R * sin(Theta));
	cameraPos.z = lineOfSight.z + (-R * sin(Phi) * cos(Theta));

	setCamera();
} //end cameraOrbit
开发者ID:vishaknag,项目名称:Simulation-clothSimulation,代码行数:35,代码来源:camera.cpp


示例11: onDisplay

void onDisplay ()
/* pre:  glut window needs to be refreshed
   post: model is drawn  */
{
  /* clears requested bits (color and depth) in glut window */
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  
  //if(wireframe)glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
 // else glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );

  
  
  /* draw entire scene into cleared window */
  glPushMatrix();
   setCamera();
   Display();
  glPopMatrix();

  /* check for any errors when rendering */
  GLenum errorCode = glGetError();
  if (errorCode == GL_NO_ERROR)
    {
      /* double-buffering - swap the back and front buffers */
      glFlush();
      glutSwapBuffers();
    }
  else
    {
      ReportError(errorCode);
    }
}
开发者ID:kkharinarayanan,项目名称:cgass2,代码行数:31,代码来源:main.cpp


示例12: setCamera

Camera::Camera(const Vector2f &worldMax,
               const Vector2f &screenMax)
{
    setCamera(Vector2f::ZERO, worldMax,
              Vector2f::ZERO, screenMax,
              Vector2f::ZERO, worldMax);
}
开发者ID:treewojima,项目名称:tile,代码行数:7,代码来源:camera.cpp


示例13: handleDisplay

/**
   Callback that occurs when glut thinks its time to redraw the window.
*/
void handleDisplay()
{
   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);

   // update the light position
   glLightfv(GL_LIGHT0, GL_POSITION, lightPosition0);

   glMatrixMode(GL_MODELVIEW);
   glLoadIdentity();
   setCamera();

   // draw the light source
   drawLightSource();

   // draw the wall background
   drawBackdropGeometry();

   // draw scene objects
   glColor3f(0.0,0.0,1.0);
   drawScene();

   // calc and draw shadows
   if (shadowsOn && light0On)
   {
      calculateShadows(floorPlane);
      drawShadows();
      calculateShadows(wallPlane);
      drawShadows();
   }

   glFlush();
   glutSwapBuffers();
}
开发者ID:JackTing,项目名称:shadows,代码行数:36,代码来源:main.cpp


示例14: glShadeModel

///////////////////////////////////////////////////////////////////////////////
// initialize OpenGL states and scene
///////////////////////////////////////////////////////////////////////////////
void ModelGL::init()
{
    glShadeModel(GL_SMOOTH);                        // shading mathod: GL_SMOOTH or GL_FLAT
    glPixelStorei(GL_UNPACK_ALIGNMENT, 4);          // 4-byte pixel alignment

    // enable /disable features
    glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
    //glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
    //glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
    glEnable(GL_DEPTH_TEST);
    glEnable(GL_LIGHTING);
    glEnable(GL_TEXTURE_2D);
    glEnable(GL_CULL_FACE);
    glEnable(GL_BLEND);

     // track material ambient and diffuse from surface color, call it before glEnable(GL_COLOR_MATERIAL)
    glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
    //glEnable(GL_COLOR_MATERIAL);

    glClearColor(bgColor[0], bgColor[1], bgColor[2], bgColor[3]);   // background color
    glClearStencil(0);                              // clear stencil buffer
    glClearDepth(1.0f);                             // 0 is near, 1 is far
    glDepthFunc(GL_LEQUAL);

    initLights();
    setCamera(0, 0, 8, 0, 0, 0);
    listId = createEarthDL();
}
开发者ID:wangfeilong321,项目名称:vdpm,代码行数:31,代码来源:ModelGL.cpp


示例15: createRenderable

	TexturePtr LinearGradient::createAsTexture(int width, int height)
	{
		const float w = static_cast<float>(width);
		const float h = static_cast<float>(height);
		
		const float sa = std::abs(std::sin(-angle_ / 180.0f * static_cast<float>(M_PI)));
		const float ca = std::abs(std::cos(-angle_ / 180.0f * static_cast<float>(M_PI)));
		//const float length = std::min(ca < FLT_EPSILON ? FLT_MAX : width / ca, sa < FLT_EPSILON ? FLT_MAX : height / sa);
		//const float length = std::min(ca < FLT_EPSILON ? w : 2.0f * ca * w, sa < FLT_EPSILON ? h : 2.0f * sa * h);

		WindowPtr wnd = WindowManager::getMainWindow();
		CameraPtr cam = std::make_shared<Camera>("ortho_lg", 0, width, 0, height);
		auto grad = createRenderable();
		grad->setCamera(cam);
		grad->setScale(ca < FLT_EPSILON ? w : 2.0f * w / ca, sa < FLT_EPSILON ? h : 2.0f * h / sa);
		grad->setPosition(w/2.0f, h/2.0f);


		RenderTargetPtr rt = RenderTarget::create(width, height);
		rt->getTexture()->setFiltering(-1, Texture::Filtering::LINEAR, Texture::Filtering::LINEAR, Texture::Filtering::POINT);
		rt->getTexture()->setAddressModes(-1, Texture::AddressMode::CLAMP, Texture::AddressMode::CLAMP);
		rt->setCentre(Blittable::Centre::TOP_LEFT);
		rt->setClearColor(Color(0,0,0,0));
		{
			RenderTarget::RenderScope rs(rt, rect(0, 0, width, height));
			grad->preRender(wnd);
			wnd->render(grad.get());
		}
		return rt->getTexture();
	}
开发者ID:sweetkristas,项目名称:hex_test,代码行数:30,代码来源:Gradients.cpp


示例16: renderScene

void renderScene(void) {
 
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 
    setCamera(10,2,10,0,2,-5);
 
    glUseProgram(p);
    setUniforms();
 
    //glBindVertexArray(vao[0]);
    glBindBuffer(GL_ARRAY_BUFFER, vbos[0]);
    glVertexAttribPointer(vertexLoc, 4, GL_FLOAT, 0, 0, 0);
    glBindBuffer(GL_ARRAY_BUFFER, vbos[1]);
    glVertexAttribPointer(colorLoc, 4, GL_FLOAT, 0, 0, 0);
    glDrawArrays(GL_TRIANGLES, 0, 3);
 
    //glBindVertexArray(vao[1]);
    glBindBuffer(GL_ARRAY_BUFFER, vbos[2]);
    glVertexAttribPointer(vertexLoc, 4, GL_FLOAT, 0, 0, 0);
    glBindBuffer(GL_ARRAY_BUFFER, vbos[3]);
    glVertexAttribPointer(colorLoc, 4, GL_FLOAT, 0, 0, 0);
    glDrawArrays(GL_TRIANGLES, 0, 3);
 
    //glBindVertexArray(vao[2]);
    glBindBuffer(GL_ARRAY_BUFFER, vbos[4]);
    glVertexAttribPointer(vertexLoc, 4, GL_FLOAT, 0, 0, 0);
    glBindBuffer(GL_ARRAY_BUFFER, vbos[5]);
    glVertexAttribPointer(colorLoc, 4, GL_FLOAT, 0, 0, 0);
    glDrawArrays(GL_LINES, 0, 6);
 
    glutSwapBuffers();
}
开发者ID:mkkellogg,项目名称:GTE,代码行数:32,代码来源:test.cpp


示例17: display

void display(void)
{
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glLoadIdentity();
	setCamera();

	/*material(slate);
	glPushMatrix();
	glTranslated(0, 0, -40);
	desenhaSolo();
	glPopMatrix();*/
		
	//desenhaEixos();
	
	desenhaLabirinto();
 
	if(estado.eixoTranslaccao) {
		cout << "Translate... " << estado.eixoTranslaccao << endl; 

	}

	glFlush();
	glutSwapBuffers();

}
开发者ID:JorgeNeves,项目名称:easySoft,代码行数:25,代码来源:lapr5.cpp


示例18: main

int main(int argc, char *argv[]) {
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_SINGLE | GLUT_RGBA | GLUT_DEPTH);
    glutInitWindowSize(800,800);
    glutInitWindowPosition(10,10);
    glutCreateWindow("Super Ellipsoid");

    glutDisplayFunc(display);
    glutKeyboardFunc(keyboard);
    glutSpecialFunc(specialKeyboard);
    glutMouseFunc(mouse);
    glutMotionFunc(mouseMotion);
    glutIdleFunc(idle);

    glutCreateMenu(displayMenu);
    glutAddMenuEntry("Increase m",1);
    glutAddMenuEntry("Decrease m",2);
    glutAddMenuEntry("Increase n",3);
    glutAddMenuEntry("Decrease n",4);
    glutAddMenuEntry("Exit",5);
    glutAttachMenu(GLUT_RIGHT_BUTTON);

    installShaders();
    setCamera();

    matrixIdentity(Projection);
    matrixPerspective(Projection,
                      40, 1.0, (GLfloat) 1, 750);

    initValues();
    glClearColor(0.0,0.0,0.0,1.0);

    glutMainLoop();
    return 0;
}
开发者ID:jenis23,项目名称:SuperEllipsoid,代码行数:35,代码来源:shadedEllipsoid.c


示例19: display

void display(void) {
	++FrameCount;
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	eye=Vec3( dist * cos( theta ) * (cos( phi )), dist * sin( theta ) * (cos( phi )), dist * sin( phi ) );
	setLighting();
    setCamera();
	float EYE[]={eye.x,eye.y,eye.z};
 
    glUseProgram(ProgramID);
    glUniformMatrix4fv(projMatrixLoc,  1, false, projMatrix);
    glUniformMatrix4fv(viewMatrixLoc,  1, false, viewMatrix);
	glUniform4fv(LightPosLoc, 1, LightPosition);
	glUniform4fv(LightDifLoc, 1, DiffuseLight);
	glUniform4fv(LightAmbLoc, 1, AmbientLight);
	glUniform4fv(LightSpecLoc, 1, SpecularLight);
	glUniform3fv(eyeLoc, 1, EYE);
 
    glBindVertexArray(VAO);
	if(MODE==0){
		glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
		glDrawElements(GL_TRIANGLES,3*model->nf,GL_UNSIGNED_INT,(GLvoid*)0);
	}
	else if(MODE==1){
		glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
		glDrawElements(GL_TRIANGLES,3*model->nf,GL_UNSIGNED_INT,(GLvoid*)0);

	}
	else if(MODE==2){
		glUniform3f(cLoc,0,0,0);
		glDrawElements(GL_POINTS,3*model->nf,GL_UNSIGNED_INT,(GLvoid*)0);
	}


    glutSwapBuffers();
}
开发者ID:AnisB,项目名称:CS112-graphics,代码行数:35,代码来源:display.cpp


示例20: setCamera

SceneView::SceneView( osg::DisplaySettings* ds)
{
    _displaySettings = ds;

    _lightingMode=NO_SCENEVIEW_LIGHT;
    
    _prioritizeTextures = false;
    
    setCamera(new Camera);
    _camera->setViewport(new Viewport);
    _camera->setClearColor(osg::Vec4(0.2f, 0.2f, 0.4f, 1.0f));
    
    _initCalled = false;

    _camera->setDrawBuffer(GL_BACK);

    _requiresFlush = true;
    
    _activeUniforms = DEFAULT_UNIFORMS;
    
    _previousFrameTime = 0;
    _previousSimulationTime = 0;
    
    _dynamicObjectCount = 0;
}
开发者ID:MichaelVlad,项目名称:Equalizer,代码行数:25,代码来源:sceneView.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ setCameraDistance函数代码示例发布时间:2022-05-30
下一篇:
C++ setCallback函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap