本文整理汇总了C++中PointBuffer::add方法的典型用法代码示例。如果您正苦于以下问题:C++ PointBuffer::add方法的具体用法?C++ PointBuffer::add怎么用?C++ PointBuffer::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PointBuffer
的用法示例。
在下文中一共展示了PointBuffer::add方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: point
void Cursor3dSample::demonstrate(const int width, const int height, const Crystal::Graphics::ICamera<float>& camera)
{
this->rotationMatrix = camera.getRotationMatrix();
glClearColor(0.7f, 0.7f, 0.7f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
PointBuffer buffer;
Point point( cursor, ColorRGBA<float>(1.0, 0.0, 0.0, 1.0), 100.0f);
buffer.add(point);
renderer.render(camera, buffer);
}
示例2: clipEdge
inline void clipEdge( bool closePolygon,
PointBuffer<Point> &points, PointBuffer<Point> &clippedPoints ) const
{
clippedPoints.reset();
if ( points.size() < 2 )
{
if ( points.size() == 1 )
clippedPoints.add( points[0] );
return;
}
const Edge edge( d_clipRect.x(), d_clipRect.x() + d_clipRect.width(),
d_clipRect.y(), d_clipRect.y() + d_clipRect.height() );
int lastPos, start;
if ( closePolygon )
{
start = 0;
lastPos = points.size() - 1;
}
else
{
start = 1;
lastPos = 0;
if ( edge.isInside( points[0] ) )
clippedPoints.add( points[0] );
}
const uint nPoints = points.size();
for ( uint i = start; i < nPoints; i++ )
{
const Point &p1 = points[i];
const Point &p2 = points[lastPos];
if ( edge.isInside( p1 ) )
{
if ( edge.isInside( p2 ) )
{
clippedPoints.add( p1 );
}
else
{
clippedPoints.add( edge.intersection( p1, p2 ) );
clippedPoints.add( p1 );
}
}
else
{
if ( edge.isInside( p2 ) )
{
clippedPoints.add( edge.intersection( p1, p2 ) );
}
}
lastPos = i;
}
}
示例3: demonstrate
void VolumeSample::demonstrate(const int width, const int height, const Crystal::Graphics::ICamera<float>& camera)
{
glEnable(GL_DEPTH_TEST);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
LegacyRenderer renderer;
PointBuffer buffer;
buffer.add(*volume);
renderer.render(camera, buffer);
LineBuffer lineBuffer;
lineBuffer.add(*polygon, ColorRGBA<float>(1.0, 0.0, 0.0, 1.0));
renderer.render(camera, lineBuffer);
}
示例4: demonstrate
void DamBreakSample::demonstrate(const int width, const int height, const Crystal::Graphics::ICamera<float>& camera)
{
this->width = width;
this->height = height;
this->rotationMatrix = camera.getRotationMatrix();
glEnable(GL_DEPTH_TEST);
interaction.simulate(1.0f / 60.0f);
PointLight<float> light;
light.setPos(Vector3d<float>(10.0f, 10.0f, -10.0f));
light.setDiffuse(ColorRGBA<float>(1.0f, 0.0f, 0.0f, 1.0f));
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
for (auto r : rigids) {
const auto matrix = r->getTransformMatrix();
auto p = r->getShape()->clone(r->getShape()->getId());
p->transform(matrix);
glViewport(0, 0, width, height);
TriangleBuffer triangleBuffer;
triangleBuffer.add(*p);
//renderer.render(camera, lineBuffer);
Material material;
material.setAmbient(ColorRGBA<float>(0.2, 0.2, 0.2, 0.0));
smoothRenderer.render(camera, triangleBuffer, light, material);
glViewport(0, 0, fb.getWidth(), fb.getHeight());
fb.bind();
idRenderer.render(camera, triangleBuffer);
fb.unbind();
delete p;
}
glClearColor(0.7f, 0.7f, 0.7f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
for (auto r : rigids) {
const auto matrix = r->getTransformMatrix();
auto p = r->getShape()->clone(r->getShape()->getId());
p->transform(matrix);
glViewport(0, 0, width, height);
TriangleBuffer triangleBuffer;
triangleBuffer.add(*p);
//renderer.render(camera, lineBuffer);
Material material;
smoothRenderer.render(camera, triangleBuffer, light, material);
//glViewport(0, 0, fb.getWidth(), fb.getHeight());
delete p;
}
glViewport(0, 0, width, height);
const auto& particles = fluid->getParticles();
float minPressure = +FLT_MAX;
float maxPressure = -FLT_MAX;
for (auto p : particles) {
minPressure = std::min<float>(minPressure, p->getDensity());
maxPressure = std::max<float>(maxPressure, p->getDensity());
}
colorMap.setMinMax(900.0f, 1400.0f);
//colorMap.setMinMax(800.0f, 2000.0f);
PointBuffer buffer;
for (auto p : particles) {
const auto pos = p->getPosition();
auto color = colorMap.getColor(p->getDensity());
color.setAlpha(0.5f);
Crystal::Graphics::Point point(pos, color, 500.0f);
buffer.add(point);
}
pointRenderer.render(camera, buffer);
}