changed winding order to allow quad from triangle strip

This commit is contained in:
ericrius1 2015-06-23 18:22:31 -07:00
parent 101400809a
commit 2c395b8fb4
2 changed files with 9 additions and 9 deletions

View file

@ -47,12 +47,10 @@ void RenderableQuadEntityItem::render(RenderArgs* args) {
transform.setTranslation(getPosition());
batch.setModelTransform(transform);
batch._glLineWidth(getLineWidth());
if (getLinePoints().size() > 3) {
DependencyManager::get<DeferredLightingEffect>()->bindSimpleProgram(batch);
DependencyManager::get<GeometryCache>()->renderVertices(batch, gpu::QUAD_STRIP, _lineVerticesID);
}
batch._glLineWidth(1.0f);
DependencyManager::get<DeferredLightingEffect>()->bindSimpleProgram(batch);
DependencyManager::get<GeometryCache>()->renderVertices(batch, gpu::TRIANGLE_STRIP, _lineVerticesID);
RenderableDebugableEntityItem::render(this, args);
};

View file

@ -137,10 +137,12 @@ bool QuadEntityItem::setLinePoints(const QVector<glm::vec3>& points) {
glm::vec3 point = points.at(i);
glm::vec3 p1 = glm::vec3(point.x - _lineWidth, point.y - _lineWidth, point.z);
glm::vec3 p2 = glm::vec3(point.x + _lineWidth, point.y - _lineWidth, point.z);
glm::vec3 p3 = glm::vec3(point.x + _lineWidth, point.y + _lineWidth, point.z);
glm::vec3 p4 = glm::vec3(point.x - _lineWidth, point.y + _lineWidth, point.z);
glm::vec3 p2 = glm::vec3(point.x - _lineWidth, point.y + _lineWidth, point.z);
glm::vec3 p3 = glm::vec3(point.x + _lineWidth, point.y - _lineWidth, point.z);
glm::vec3 p4 = glm::vec3(point.x + _lineWidth, point.y + _lineWidth, point.z);
_quadVertices << p1 << p2 << p3 << p4;
}
return true;
}