本文整理汇总了C++中Stroke::color方法的典型用法代码示例。如果您正苦于以下问题:C++ Stroke::color方法的具体用法?C++ Stroke::color怎么用?C++ Stroke::color使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stroke
的用法示例。
在下文中一共展示了Stroke::color方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CLAMP
void LineSegment3D::Render(const CameraInfo &camera, double max_width,
int stroke_texture, ParameterBound stroke_bounds)
{
#ifndef __BUNDLER__
#ifndef __DEMO__
#if 1
/* Project the line into the camera */
double p1[4] = { m_p1[0], m_p1[1], m_p1[2], 1.0 };
double p2[4] = { m_p2[0], m_p2[1], m_p2[2], 1.0 };
double proj1[3], proj2[3];
matrix_product(3, 4, 4, 1, (double *) camera.m_Pmatrix, p1, proj1);
matrix_product(3, 4, 4, 1, (double *) camera.m_Pmatrix, p2, proj2);
if (proj1[2] >= 0.0 || proj2[2] >= 0.0)
return;
double width = CLAMP(5.0 / (-proj1[2] - proj2[2]), 0.5, max_width);
proj1[0] /= -proj1[2];
proj1[1] /= -proj1[2];
proj2[0] /= -proj2[2];
proj2[1] /= -proj2[2];
#endif
#if 0
bool in_front1 = camera.Project(m_p1, proj1);
bool in_front2 = camera.Project(m_p2, proj2);
if (!in_front1 || !in_front2)
return;
#endif
/* Draw a line segment whose width is proportional to the distance
* from the camera */
#if 0
double pos[3];
camera.GetPosition(pos);
double disp[3];
matrix_diff(3, 1, 3, 1, pos, m_p1, disp);
double dist = matrix_norm(3, 1, disp);
#endif
if (stroke_texture != -1) {
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, stroke_texture);
}
#if 0
#define LINE_WIDTH_SIGMA 1.0
double width =
max_width * exp(-dist * dist / (LINE_WIDTH_SIGMA * LINE_WIDTH_SIGMA));
#endif
/* Create a stroke */
Stroke s;
s.radius() = 0.5 * width;
s.cap() = false;
s.depth() = 1.0;
if (stroke_texture == -1) {
s.useTexture() = false;
s.color() = makeColor(0, 0, 0, 0.9f);
} else {
GLubyte b = 0x0;
s.useTexture() = true;
s.color() = makeColor(b, b, b, 0.9f);
}
s.addControlPoint(proj1[0], proj1[1]);
s.addControlPoint(proj2[0], proj2[1]);
s.render();
if (stroke_texture != -1) {
glDisable(GL_TEXTURE_2D);
}
#endif /* __DEMO__ */
#endif /* __BUNDLER__ */
}