本文整理汇总了C++中Camera函数的典型用法代码示例。如果您正苦于以下问题:C++ Camera函数的具体用法?C++ Camera怎么用?C++ Camera使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Camera函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: root
View::View(Chose* _root)
: root(_root),
camera(Camera(Vertex(0,0,5000), 45, 100, 10000, 0.6f)),
lod(camera.cameraCenter, _root) {
fogColor[0] = Couleurs::r(Couleurs::fog) / 255.f;
fogColor[1] = Couleurs::g(Couleurs::fog) / 255.f;
fogColor[2] = Couleurs::b(Couleurs::fog) / 255.f;
fogColor[3] = 1.0;
initWindow();
mainLoop();
}
开发者ID:jsmaniac,项目名称:2011-m2s3-city-builder,代码行数:12,代码来源:view.cpp
示例2: TEST
TEST(CameraTest, PassValuesToVec3) {
Camera c = Camera(vec3(0, 0, 2), vec3(0, 0, 0), vec3(0, 1, 0), 90);
EXPECT_EQ(c.lookFrom.z, 2);
EXPECT_EQ(c.lookAt.y, 0);
EXPECT_EQ(c.up.y, 1);
EXPECT_EQ(c.fovy, 90);
// coord frame
EXPECT_EQ(c.u, vec3(1,0,0));
EXPECT_EQ(c.v, vec3(0,1,0));
EXPECT_EQ(c.w, vec3(0,0,1));
}
开发者ID:xysun,项目名称:raytracer,代码行数:12,代码来源:CameraTest.cpp
示例3: EdsGetChildAtIndex
Camera CameraList::get(const int index)
{
EdsCameraRef camera = nullptr;
EdsError err = EdsGetChildAtIndex(list_, 0, &camera);
if (EDS_ERR_OK != err) {
DEBUGSTREAM << DescribeError(err) << std::endl;
throw Exception(err);
}
Camera retval = Camera(camera);
retval.Initialize();
return retval;
}
开发者ID:ollie-williams,项目名称:dslr,代码行数:13,代码来源:camera_list.cpp
示例4: sqrt
/**
* Create a new Camera based on a model.
*
* @param m the model to base the camera on
* @return a new Camera that looks at the model
*/
Camera Camera::fromModel(const Model& m) {
auto box = m.getBounds();
auto zdiff = sqrt(
pow(box.len().y(), 2) * pow(box.len().x(), 2)) + box.len().z();
auto fl = -1.0;
auto up = Vector(0, 1, 0);
auto at = Vector(0, 0, 1);
auto fp = (box.min() + (box.len() / 2.0)) + Vector(0, 0, 0.25 * zdiff);
auto vrp = fp + (at * fl);
return Camera(fp, vrp, up);
}
开发者ID:fidgetting,项目名称:RayTracer-v2,代码行数:19,代码来源:Camera.cpp
示例5: m_crate
Crate_State::Crate_State()
: m_crate(Point3f(35.0f, 12.0f, 0.0f),
Vector3f(30.0f, 30.0f, 30.0f)),
other_crate(Point3f(35.0f, 50.0f, 50.0f),
Vector3f(30.0f, 30.0f, 30.0f)),
m_player(Camera(Point3f(0.0f, 0.0f, 50.0f),
Quaternion(),
1.0f, 10000.0f),
Vector3f(0.0f, 0.0f, -39.0f),
11.0f)
{
set_pausable(true);
}
开发者ID:linshu123,项目名称:494_p3,代码行数:13,代码来源:Crate_State.cpp
示例6: NormalizeRect
void CHMMDemoView::SetSelection( RECT* sel )
{
if( sel )
{
m_tmp_sel = NormalizeRect( *sel );
}
else
{
CImage& img = Camera().GetFrame();
m_tmp_sel = CRect( 0, 0, img.Width(), img.Height() );
}
CheckUpdate();
}
开发者ID:otoauler,项目名称:sdkpub,代码行数:13,代码来源:HMMDemoView.cpp
示例7: kbd
/*
* Instructions on using this program:
*
* 'H' - hardware viewing and perspective transforms
* 'O' - orthographic projection mode
* 'P' - perspective projection mode
* 'I' - reset to original setup
*
* In each mode, pressing the 'l', 'k', 'w' keys
* makes the transformation in the 'forward' direction,
* pressing 'h', 'j', 's' makes the transformation in the
* 'reverse' direction. You are required to implement this
* functionality. Look at the kbd() function to see how
* the various functions are called.
*
*/
void
kbd(unsigned char key, int x, int y)
{
switch(key) {
case 'q': /* quit */
case 27 :
glutDestroyWindow(wd);
exit (0);
case 'I': /* reset */
cam = Camera(eye_pos0, gaze_dir0, top_dir0, zNear0, zFar0, fovy0);
resetWorld(mode);
setup_view(mode);
transformWorld(mode); // TODO do the transform, including perspective transform in objects.cpp
fprintf(stderr, "Reset!\n");
break;
case 'H':
mode = HARDWARE;
init_viewcam(mode);
reshape(screen_w, screen_h);
fprintf(stderr, "Hardware transforms\n");
break;
case 'O':
mode = ORTHOGRAPHIC;
init_viewcam(mode);
reshape(screen_w, screen_h);
fprintf(stderr, "Orthographic mode\n");
break;
case 'P':
mode = PERSPECTIVE;
init_viewcam(mode);
reshape(screen_w, screen_h);
fprintf(stderr, "Perspective mode\n");
break;
default:
movecam(key, x, y); // TODO in transfomrs.cpp
setup_view(mode); // TODO set up the viewing transformation in transforms.cpp
transformWorld(mode); // TODO do the transform, including perspective transform in objects.cpp
break;
}
glutPostRedisplay();
return;
}
开发者ID:kbailo,项目名称:487,代码行数:67,代码来源:viewing.cpp
示例8: Camera
void Viewer::setup_scene() {
trac0r::Material emissive{1, {1.f, 0.93f, 0.85f}, 0.f, 1.f, 15.f};
trac0r::Material default_material{2, {0.740063, 0.742313, 0.733934}};
trac0r::Material diffuse_red{2, {0.366046, 0.0371827, 0.0416385}};
trac0r::Material diffuse_green{2, {0.162928, 0.408903, 0.0833759}};
trac0r::Material glass{3, {0.5f, 0.5f, 0.9f}, 0.0f, 1.51714f};
trac0r::Material glossy{4, {1.f, 1.f, 1.f}, 0.09f};
auto wall_left = trac0r::Shape::make_plane({-0.5f, 0.4f, 0}, {0, 0, -glm::half_pi<float>()},
{1, 1}, diffuse_red);
auto wall_right = trac0r::Shape::make_plane({0.5f, 0.4f, 0}, {0, 0, glm::half_pi<float>()},
{1, 1}, diffuse_green);
auto wall_back = trac0r::Shape::make_plane({0, 0.4f, 0.5}, {-glm::half_pi<float>(), 0, 0},
{1, 1}, default_material);
auto wall_top =
trac0r::Shape::make_plane({0, 0.9f, 0}, {glm::pi<float>(), 0, 0}, {1, 1}, default_material);
auto wall_bottom =
trac0r::Shape::make_plane({0, -0.1f, 0}, {0, 0, 0}, {1, 1}, default_material);
auto lamp = trac0r::Shape::make_plane({0, 0.85f, -0.1}, {0, 0, 0}, {0.4, 0.4}, emissive);
auto box1 = trac0r::Shape::make_box({0.3f, 0.1f, 0.1f}, {0, 0.6f, 0}, {0.2f, 0.5f, 0.2f},
default_material);
auto box2 =
trac0r::Shape::make_box({-0.2f, 0.15f, 0.1f}, {0, -0.5f, 0}, {0.3f, 0.6f, 0.3f}, glossy);
if (m_benchmark_mode > 0) {
auto sphere1 = trac0r::Shape::make_icosphere({0.f, 0.1f, -0.3f}, {0, 0, 0}, 0.15f,
m_benchmark_mode - 1, default_material);
Scene::add_shape(m_scene, sphere1);
} else {
auto sphere1 =
trac0r::Shape::make_icosphere({0.f, 0.1f, -0.3f}, {0, 0, 0}, 0.15f, 2, glass);
auto sphere2 =
trac0r::Shape::make_icosphere({0.3f, 0.45f, 0.1f}, {0, 0, 0}, 0.15f, 2, glossy);
Scene::add_shape(m_scene, sphere1);
Scene::add_shape(m_scene, sphere2);
}
Scene::add_shape(m_scene, wall_left);
Scene::add_shape(m_scene, wall_right);
Scene::add_shape(m_scene, wall_back);
Scene::add_shape(m_scene, wall_top);
Scene::add_shape(m_scene, wall_bottom);
Scene::add_shape(m_scene, lamp);
Scene::add_shape(m_scene, box1);
Scene::add_shape(m_scene, box2);
glm::vec3 cam_pos = {0, 0.31, -1.2};
glm::vec3 cam_dir = {0, 0, 1};
glm::vec3 world_up = {0, 1, 0};
m_camera =
Camera(cam_pos, cam_dir, world_up, 90.f, 0.001, 100.f, m_screen_width, m_screen_height);
}
开发者ID:svenstaro,项目名称:trac0r,代码行数:51,代码来源:viewer.cpp
示例9: file
void rt::Ra2Parser::loadCamFile(const std::string& filename)
{
std::ifstream file(filename.c_str());
std::string line;
std::vector<std::string> tokens;
Point position;
Vector direction;
Vector up;
float depth;
float filmSizeY;
if (file.is_open()) {
while (!file.eof()) {
getline(file, line);
tokenize(line, tokens);
if (tokens[0] == "position") {
float x = atof(tokens[1].c_str());
float y = atof(tokens[2].c_str());
float z = atof(tokens[3].c_str());
position = Point(x,y,z);
}
else if (tokens[0] == "direction") {
float x = atof(tokens[1].c_str());
float y = atof(tokens[2].c_str());
float z = atof(tokens[3].c_str());
direction = Vector(x,y,z);
}
else if (tokens[0] == "up") {
float x = atof(tokens[1].c_str());
float y = atof(tokens[2].c_str());
float z = atof(tokens[3].c_str());
up = Vector(x,y,z);
}
else if (tokens[0] == "depth") {
depth = atof(tokens[1].c_str());
}
else if (tokens[0] == "filmSizeY") {
filmSizeY = atof(tokens[1].c_str());
}
}
float fovy = toDegrees(atan((filmSizeY / 2) / depth));
camera_ = Camera(position, direction, up, fovy, fovy, depth, 1024, 1024);
}
else
std::cerr << "Unabe to open file " << filename << std::endl;
file.close();
}
开发者ID:thomasloockx,项目名称:Ray-Tracer,代码行数:51,代码来源:ra2parser.cpp
示例10: ImportCamera
void SceneLoader::ImportCamera(Scene& scene, const aiCamera* const camera) {
float width = camera->mAspect;
float height = 1.0;
glm::mat4x4 persp = glm::perspective(camera->mHorizontalFOV, camera->mAspect,
camera->mClipPlaneNear, camera->mClipPlaneFar);
aiVector3D ai_at = camera->mLookAt;
aiVector3D ai_pos = camera->mPosition;
aiVector3D ai_up = camera->mUp;
glm::vec3 at = glm::vec3(ai_at[0], ai_at[1], ai_at[2]);
glm::vec3 pos = glm::vec3(ai_pos[0], ai_pos[1], ai_pos[2]);
glm::vec3 up = glm::vec3(ai_up[0], ai_up[1], ai_up[2]);
glm::mat4x4 look_at = glm::lookAt(pos, at, up);
scene.AddCamera(Camera(width, height, persp, look_at));
}
开发者ID:rasmith,项目名称:RayTracerX,代码行数:14,代码来源:scene_utils.cpp
示例11: TEXT
Void RPGGame::_CreateWorld()
{
BaseCharacter * pPlayer = GameplayFn->GetCharacter( TEXT("Shiki") );
// Landscape
m_pLandscape = New Landscape();
m_pLandscape->SetEyeEntity( pPlayer->GetEntity() );
WorldFn->AddChild( m_pLandscape );
// World camera
m_pRenderCamera = New Camera( true );
m_pWorldCamera = New WorldCamera3rdPerson( m_pRenderCamera, pPlayer->GetEntity(), NULL, 3.0f );
WorldFn->SetWorldCamera( m_pWorldCamera );
}
开发者ID:Shikifuyin,项目名称:Scarab-Engine,代码行数:14,代码来源:Main.cpp
示例12: cam_Update
void CWeaponStatMgun::UpdateCL()
{
inheritedPH::UpdateCL ();
UpdateBarrelDir ();
UpdateFire ();
if(OwnerActor() && OwnerActor()->IsMyCamera())
{
cam_Update(Device.fTimeDelta, g_fov);
OwnerActor()->Cameras().UpdateFromCamera(Camera());
OwnerActor()->Cameras().ApplyDevice(VIEWPORT_NEAR);
}
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:14,代码来源:WeaponStatMgun.cpp
示例13: strtok
PAIS::Camera FileLoader::loadNvm2Camera(ifstream &file, const char* path) {
// camera information
string fileName = path;
Vec2d focal;
Vec2d principlePoint;
Vec4d quaternion;
Vec3d center;
char strbuf[STRING_BUFFER_LENGTH];
char *strip;
file.getline(strbuf, STRING_BUFFER_LENGTH);
// image file name
strip = strtok(strbuf, DELIMITER);
fileName.append(strip);
// focal length
strip = strtok(NULL, DELIMITER);
focal[0] = atof(strip);
strip = strtok(NULL, DELIMITER);
focal[1] = atof(strip);
// priciple point
strip = strtok(NULL, DELIMITER);
principlePoint[0] = atof(strip);
strip = strtok(NULL, DELIMITER);
principlePoint[1] = atof(strip);
// quaternion rotation
strip = strtok(NULL, DELIMITER); // k
quaternion[0] = atof(strip);
strip = strtok(NULL, DELIMITER); // wx
quaternion[1] = atof(strip);
strip = strtok(NULL, DELIMITER); // wy
quaternion[2] = atof(strip);
strip = strtok(NULL, DELIMITER); // wz
quaternion[3] = atof(strip);
// 3D camera center in world coordinate
Vec3d cameraCenter;
strip = strtok(NULL, DELIMITER); // cx
center[0] = atof(strip);
strip = strtok(NULL, DELIMITER); // cy
center[1] = atof(strip);
strip = strtok(NULL, DELIMITER); // cz
center[2] = atof(strip);
return Camera(fileName.c_str(), focal, principlePoint, quaternion, center, 0);
}
开发者ID:yuhuangintel,项目名称:pais-mvs,代码行数:49,代码来源:fileloader.cpp
示例14: cam
EKFOA::EKFOA() :
cam(Camera(
//Sample
// 0.0112, //d
// 1.7945 / 0.0112, //Cx
// 1.4433 / 0.0112, //Cy
// 6.333e-2, //k1
// 1.390e-2, //k2
// 2.1735 //f
//1394_HQ
// 743.820952250528, //fx
// 745.938565001168, //fy
// 340.661572727241, //cx
// 236.368684007102, //cy
// -0.220047987197564, //k1
// 0.220478586879841 //k2
// //1394_DownSample
// 369.63729683985, //fx
// 370.836503127339, //fy
// 170.501040779887, //cx
// 118.086801153144, //cy
// -0.212379296868053, //k1
// 0.189944746349158 //k2
//ARDRONE:
588.878779108602, //fx
588.643674196636, //fy
303.725019622098, //cx
185.837132396075, //cy
-0.550446697998159, //k1
0.311341231340524 //k2
)),
filter(Kalman(
0.0, //v_0
0.025, //std_v_0
1e-15, //w_0
0.025, //std_w_0
0.007, //standar deviation for linear acceleration noise
0.007, //standar deviation for angular acceleration noise
1.0 //standar deviation for measurement noise
)),
motion_tracker(MotionTrackerOF(
30, //min_number_of_features_in_image
20 //distance_between_points
)) {
}
开发者ID:Yvaine,项目名称:ekfoa,代码行数:49,代码来源:ekfoa.cpp
示例15: m_gl_context
Renderer::Renderer( GLContext* gl_context )
: m_gl_context( gl_context ),
m_scene(),
m_run( false ),
m_width( 0 ),
m_height( 0 ),
m_translation_zoom_scale( 1 )
{
double temp_pos[] = { 0.0, 0.0, 0.0 };
double temp_dir[] = { 0.0, 0.0, -1.0 };
double temp_up[] = { 0.0, 1.0, 0.0 };
m_camera = Camera( temp_pos, temp_dir, temp_up );
m_gl_context->makeCurrent();
}
开发者ID:dedonaldson,项目名称:vrc-new,代码行数:15,代码来源:Renderer.cpp
示例16: Camera
void C_MatchBall::OnDataChanged(DataUpdateType_t updateType)
{
BaseClass::OnDataChanged( updateType );
if (updateType == DATA_UPDATE_CREATED)
{
if (!g_pBall)
{
g_pBall = this;
Camera()->SetTarget(this->entindex());
}
SetNextClientThink(CLIENT_THINK_ALWAYS);
}
}
开发者ID:Rahmstein,项目名称:IOS,代码行数:15,代码来源:c_match_ball.cpp
示例17: property_
TemplatePropertyTimeline<Camera>::TemplatePropertyTimeline(TemplateProperty<Camera>* prop)
: property_(prop)
, activeOnRendering_(true)
, timelineChanged_(false)
{
duration_ = 60.f * 15.f;
tgt::Camera cam = property_->get();
// Camera* node0 = new Camera(cam->getPosition(), cam->getFocus(), cam->getUpVector(), cam->getStrafe());
// node0->setNodeIdentifier("Node 0");
// node0->setDirection(node0->getStrafe());
Camera node0 = Camera(cam);
timeline_ = new CameraPropertyTimelineState(new PropertyKeyValue<Camera>(node0, 0.f));
}
开发者ID:bsmr-opengl,项目名称:voreen,代码行数:15,代码来源:templatepropertytimeline.cpp
示例18: cpBodyGetVelocity
void Stage::processContinuousInput(){
if(keyStates[GLFW_KEY_A])
{
cpVect curVel = cpBodyGetVelocity(userControlObject->body);
if(curVel.x >= -1000.0)
cpBodySetForce(userControlObject->body, cpv(-100000.0, 0.0));
}
if(keyStates[GLFW_KEY_D])
{
cpVect curVel = cpBodyGetVelocity(userControlObject->body);
if(curVel.x <= 1000.0)
cpBodySetForce(userControlObject->body, cpv(100000.0, 0.0));
}
if(!keyStates[GLFW_KEY_A] && !keyStates[GLFW_KEY_D])
{
cpVect curVel = cpBodyGetVelocity(userControlObject->body);
if(curVel.x != 0)
{
curVel.x /= 1.1;
if(curVel.x > -100 || curVel.x < 100)
curVel.x = 0;
cpBodySetVelocity(userControlObject->body, curVel);
}
}
if(keyStates[GLFW_KEY_SPACE]){
cpVect curVel = cpBodyGetVelocity(userControlObject->body);
// if(curVel.y < 0.5 && curVel.y > -0.5){
// cpBodySetVelocity(userControlObject->body, cpvadd(curVel, cpv(0.0, 1150.0)));
// soundMap.find("Jump")->second->play();
// }
if(userControlObject->canJump){
cpBodySetVelocity(userControlObject->body, cpvadd(curVel, cpv(0.0, 1150.0)));
soundMap.find("Jump")->second->play();
}
}
if(keyStates[GLFW_KEY_E]){
firstPerson = !firstPerson;
camera = Camera();
keyStates[GLFW_KEY_E] = 0;
}
}
开发者ID:palmerst,项目名称:CS-4ZP6,代码行数:48,代码来源:Stage.cpp
示例19: main
int main() {
// Initiatisation
glm::ivec2 screenSize = glm::ivec2(400, 300);
// -- Camera
Camera cam = Camera(70.f, screenSize, 1);
cam.LookAt(glm::vec3(50,52,295.6), glm::vec3(50,52,295.6) + glm::vec3(0,0.0,-1));
// -- Scene
Scene sc;
// Sphere(1e5, Vec( 1e5+1,40.8,81.6), Vec(),Vec(.75,.25,.25),DIFF),//Left
// Sphere(1e5, Vec(-1e5+99,40.8,81.6),Vec(),Vec(.25,.25,.75),DIFF),//Rght
// Sphere(1e5, Vec(50,40.8, 1e5), Vec(),Vec(.75,.75,.75),DIFF),//Back
// Sphere(1e5, Vec(50,40.8,-1e5+170), Vec(),Vec(), DIFF),//Frnt
// Sphere(1e5, Vec(50, 1e5, 81.6), Vec(),Vec(.75,.75,.75),DIFF),//Botm
// Sphere(1e5, Vec(50,-1e5+81.6,81.6),Vec(),Vec(.75,.75,.75),DIFF),//Top
sc.AddPrimitive(
new Sphere(glm::vec3(1e5 + 1, 40.8, 81.6), 1e5,
Material(glm::vec3(.75, .25, .25))));
sc.AddPrimitive(
new Sphere(glm::vec3(-1e5 + 99, 40.8, 81.6), 1e5,
Material(glm::vec3(.25, .25, .75))));
sc.AddPrimitive(
new Sphere(glm::vec3(50,40.8, 1e5), 1e5,
Material(glm::vec3(.75, .75, .75))));
sc.AddPrimitive(
new Sphere(glm::vec3(50, 40.8, -1e5 + 250), 1e5,
Material(glm::vec3(.75, .75, .75))));
sc.AddPrimitive(
new Sphere(glm::vec3(50, 1e5, 81.6), 1e5,
Material(glm::vec3(.75, .75, .75))));
sc.AddPrimitive(
new Sphere(glm::vec3(50,-1e5+81.6,81.6), 1e5,
Material(glm::vec3(.75, .75, .75))));
sc.AddLight(new PointLight(glm::vec3(50,52,240)));
// -- Screne
Screen screen(screenSize);
// Ray generation
for (int x = 0; x < screenSize.x; x++)
for (int y = 0; y < screenSize.y; y++) {
glm::vec3 colorFinal = sc.ComputeColor(cam.GetRay(x,y));
screen.Store(x, y, colorFinal*100.f);
}
screen.SaveToPGM("out.pgm");
return 0;
}
开发者ID:beltegeuse,项目名称:RayTracing,代码行数:48,代码来源:main.cpp
示例20: init
GLint init()
{
glfwInit();
/* Create a GLFW window */
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR,3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR,3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);
window = glfwCreateWindow(screenWidth, screenHeight, "Learning OpenGL", nullptr, nullptr);
if (window == nullptr)
{
std::cout << "Failed to create GLFW window" << std::endl;
glfwTerminate();
return -1;
}
glfwMakeContextCurrent(window);
/* Initialize GLEW */
glewExperimental = GL_TRUE;
if (glewInit() != GLEW_OK)
{
std::cout << "Failed to initialize GLEW" << std::endl;
return -1;
}
glViewport(0, 0, 800, 600);
/* Input */
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
glfwSetKeyCallback(window, key_callback);
glfwSetCursorPosCallback(window, mouse_callback);
glEnable(GL_DEPTH_TEST);
cubeShader = Shader("cube.vert", "cube.frag");
lightShader = Shader("light.vert", "light.frag");
viewCamera = Camera( glm::vec3(0.0f, 0.0f, 3.0f),
glm::vec3(0.0f, 0.0f,-1.0f),
glm::vec3(0.0f, 1.0f, 0.0f),
5.0f );
return 0;
}
开发者ID:jmiron11,项目名称:opengl-fun,代码行数:47,代码来源:test.cpp
注:本文中的Camera函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论