6 #include <pxr/usd/usdGeom/camera.h>
7 #include <pxr/usd/usdGeom/tokens.h>
40 *r_sensor_x =
camera->sensor_x;
41 *r_sensor_y =
camera->sensor_x * sizey / sizex;
44 *r_sensor_x =
camera->sensor_y * sizex / sizey;
45 *r_sensor_y =
camera->sensor_y;
48 BLI_assert_msg(0,
"Camera fit should be either horizontal or vertical");
62 usd_camera.CreateProjectionAttr().Set(pxr::UsdGeomTokens->
perspective);
68 usd_camera.CreateFocalLengthAttr().Set(
camera->lens, timecode);
70 float aperture_x, aperture_y;
73 float film_aspect = aperture_x / aperture_y;
74 usd_camera.CreateHorizontalApertureAttr().Set(aperture_x, timecode);
75 usd_camera.CreateVerticalApertureAttr().Set(aperture_y, timecode);
76 usd_camera.CreateHorizontalApertureOffsetAttr().Set(aperture_x *
camera->shiftx, timecode);
77 usd_camera.CreateVerticalApertureOffsetAttr().Set(aperture_y *
camera->shifty * film_aspect,
80 usd_camera.CreateClippingRangeAttr().Set(
81 pxr::VtValue(pxr::GfVec2f(
camera->clip_start,
camera->clip_end)), timecode);
85 usd_camera.CreateFStopAttr().Set(
camera->dof.aperture_fstop, timecode);
89 usd_camera.CreateFocusDistanceAttr().Set(focus_distance, timecode);
Camera data-block and utility functions.
float BKE_camera_object_dof_distance(const struct Object *ob)
int BKE_camera_sensor_fit(int sensor_fit, float sizex, float sizey)
#define BLI_assert_msg(a, msg)
struct Scene * DEG_get_evaluated_scene(const struct Depsgraph *graph)
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between camera
pxr::UsdTimeCode get_export_time_code() const
const USDExporterContext usd_export_context_
USDCameraWriter(const USDExporterContext &ctx)
virtual bool is_supported(const HierarchyContext *context) const override
virtual void do_write(HierarchyContext &context) override
static void camera_sensor_size_for_render(const Camera *camera, const struct RenderData *rd, float *r_sensor_x, float *r_sensor_y)
static const pxr::TfToken perspective("perspective", pxr::TfToken::Immortal)
const pxr::SdfPath usd_path
const pxr::UsdStageRefPtr stage