本文整理汇总了C++中ref_ptr::GetProgram方法的典型用法代码示例。如果您正苦于以下问题:C++ ref_ptr::GetProgram方法的具体用法?C++ ref_ptr::GetProgram怎么用?C++ ref_ptr::GetProgram使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ref_ptr
的用法示例。
在下文中一共展示了ref_ptr::GetProgram方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Build
void Arrow3d::Render(ScreenBase const & screen, int zoomLevel, ref_ptr<dp::GpuProgramManager> mng)
{
// Unbind current VAO, because glVertexAttributePointer and glEnableVertexAttribute can affect it.
if (dp::GLExtensionsList::Instance().IsSupported(dp::GLExtensionsList::VertexArrayObject))
GLFunctions::glBindVertexArray(0);
if (!m_isInitialized)
{
Build();
m_isInitialized = true;
}
// Render shadow.
if (screen.isPerspective())
{
ref_ptr<dp::GpuProgram> shadowProgram = mng->GetProgram(gpu::ARROW_3D_SHADOW_PROGRAM);
RenderArrow(screen, shadowProgram, dp::Color(60, 60, 60, 60), 0.05f, false /* hasNormals */);
}
// Render arrow.
ref_ptr<dp::GpuProgram> arrowProgram = mng->GetProgram(gpu::ARROW_3D_PROGRAM);
dp::Color const color = df::GetColorConstant(GetStyleReader().GetCurrentStyle(),
m_obsoletePosition ? df::Arrow3DObsolete : df::Arrow3D);
RenderArrow(screen, arrowProgram, color, 0.0f, true /* hasNormals */);
arrowProgram->Unbind();
GLFunctions::glBindBuffer(0, gl_const::GLArrayBuffer);
}
示例2: Apply
void RenderNode::Apply(ref_ptr<dp::GpuProgramManager> mng, dp::UniformValuesStorage const & uniforms)
{
ref_ptr<dp::GpuProgram> prg = mng->GetProgram(m_state.GetProgramIndex());
prg->Bind();
if (!m_isBuilded)
{
m_buffer->Build(prg);
m_isBuilded = true;
}
dp::ApplyState(m_state, prg);
dp::ApplyUniforms(uniforms, prg);
}
示例3: BuildBuckets
void BuildBuckets(RouteRenderProperty const & renderProperty, ref_ptr<dp::GpuProgramManager> mng)
{
for (drape_ptr<dp::RenderBucket> const & bucket : renderProperty.m_buckets)
bucket->GetBuffer()->Build(mng->GetProgram(renderProperty.m_state.GetProgramIndex()));
}
示例4: Build
void Arrow3d::Render(ScreenBase const & screen, ref_ptr<dp::GpuProgramManager> mng)
{
// Unbind current VAO, because glVertexAttributePointer and glEnableVertexAttribute can affect it.
GLFunctions::glBindVertexArray(0);
ref_ptr<dp::GpuProgram> prg = mng->GetProgram(gpu::ARROW_3D_PROGRAM);
prg->Bind();
if (!m_isInitialized)
{
Build(prg);
m_isInitialized = true;
}
dp::ApplyState(m_state, prg);
static double const kLog2 = log(2.0);
double const kMaxZoom = scales::UPPER_STYLE_SCALE + 1.0;
double const zoomLevel = my::clamp(fabs(log(screen.GetScale()) / kLog2), kArrow3dMinZoom, kMaxZoom);
double const t = (zoomLevel - kArrow3dMinZoom) / (kMaxZoom - kArrow3dMinZoom);
double const arrowScale = kArrow3dScaleMin * (1.0 - t) + kArrow3dScaleMax * t;
double const scaleX = m_pixelWidth * arrowScale * 2.0 / screen.PixelRect().SizeX() / kArrowSizeX;
double const scaleY = m_pixelHeight * arrowScale * 2.0 / screen.PixelRect().SizeY() / kArrowSizeY;
double const scaleZ = scaleX;
m2::PointD const pos = screen.GtoP(m_position);
double const dX = 2.0 * pos.x / screen.PixelRect().SizeX() - 1.0;
double const dY = 2.0 * pos.y / screen.PixelRect().SizeY() - 1.0;
math::Matrix<float, 4, 4> scaleM = math::Identity<float, 4>();
scaleM(0, 0) = scaleX;
scaleM(1, 1) = scaleY;
scaleM(2, 2) = scaleZ;
math::Matrix<float, 4, 4> rotateM = math::Identity<float, 4>();
rotateM(0, 0) = cos(m_azimuth + screen.GetAngle());
rotateM(0, 1) = -sin(m_azimuth + screen.GetAngle());
rotateM(1, 0) = -rotateM(0, 1);
rotateM(1, 1) = rotateM(0, 0);
math::Matrix<float, 4, 4> translateM = math::Identity<float, 4>();
translateM(3, 0) = dX;
translateM(3, 1) = -dY;
math::Matrix<float, 4, 4> modelTransform = rotateM * scaleM * translateM;
modelTransform = modelTransform * math::Matrix<float, 4, 4>(screen.Pto3dMatrix());
dp::UniformValuesStorage uniforms;
uniforms.SetMatrix4x4Value("m_transform", modelTransform.m_data);
dp::ApplyUniforms(uniforms, prg);
GLFunctions::glBindBuffer(m_bufferId, gl_const::GLArrayBuffer);
GLFunctions::glEnableVertexAttribute(m_attributePosition);
GLFunctions::glVertexAttributePointer(m_attributePosition, 3, gl_const::GLFloatType, false, 0, 0);
GLFunctions::glBindBuffer(m_bufferNormalsId, gl_const::GLArrayBuffer);
GLFunctions::glEnableVertexAttribute(m_attributeNormal);
GLFunctions::glVertexAttributePointer(m_attributeNormal, 3, gl_const::GLFloatType, false, 0, 0);
GLFunctions::glDrawArrays(gl_const::GLTriangles, 0, m_vertices.size() / 3);
prg->Unbind();
GLFunctions::glBindBuffer(0, gl_const::GLArrayBuffer);
}