void PbrtSceneImporter::_pbrtCamera(PbrtImport::SubString i_name, const PbrtImport::ParamSet &i_params) { if (_VerifyOptions("Camera")==false) return; mp_renderOptions->CameraName = i_name.to_string(); mp_renderOptions->CameraParams = i_params; // Need to reflect the camera against the X axis to account for the fact that pbrt is based on the left-handed coordinate system, while our system is right-handed mp_renderOptions->CameraToWorld = (MakeScale(-1, 1, 1)*m_current_transform*MakeScale(1, 1, 1)).Inverted(); m_namedCoordinateSystems["camera"] = mp_renderOptions->CameraToWorld; }
void BuildRasterTransform(Transform *rt, int width, int height) { Vector3 offset; offset.x = 0.f; offset.y = -1.f; offset.z = 3.0f;//145.f;//0.3f; Transform meshOffset = MakeTranslation(&offset); TransformTrans(&meshOffset, rt, rt); float temp = 1.66f/offset.z; Vector3 v; v.x = temp; v.y = -temp; v.z = 1.f; Transform t = MakeScale(&v); TransformTrans(&t, rt, rt); v.x = (float)width/(float)height; v.y = 1.f; v.z = 0.f; t = MakeTranslation(&v); TransformTrans(&t, rt, rt); v.x = height/(2.0f); v.y = height/2.0f; v.z = 1.f; t = MakeScale(&v); TransformTrans(&t, rt, rt); }
static void ddRenderSpheres(const mat4& projview) { const ShaderInfo* shader = g_dbgdrawShader.get(); GLint colorLoc = shader->m_attrs[GEOM_Color]; GLint mvpLoc = shader->m_uniforms[BIND_Mvp]; const ddSphere* cur = g_lists.m_spheres; while(cur) { // ignore scale -- debug spheres have to be spheres vec3 center = TransformPoint(cur->m_xfm, cur->m_center); mat4 model = MakeTranslation(center.x, center.y, center.z) * MakeScale(cur->m_radius, cur->m_radius, cur->m_radius); mat4 mvp = projview * model; glVertexAttrib3fv(colorLoc, &cur->m_color.r); glUniformMatrix4fv(mvpLoc, 1, 0, mvp.m); g_dbgSphereGeom->Render(*shader); cur = cur->m_next; } }
mat4 MakeScale(const vec3& v) { return MakeScale(v.x, v.y, v.z); }
void PbrtSceneImporter::_pbrtScale(float i_sx, float i_sy, float i_sz) { if (_VerifyInitialized("Scale")==false) return; m_current_transform = m_current_transform * MakeScale(i_sx, i_sy, i_sz); }
void HeatTree::FinishDrawing(ostream& os, double xscale, double yscale) { MakeScale(os); }