mirror of
https://github.com/lubosz/overte.git
synced 2025-04-23 05:24:06 +02:00
Using pipelines properly where appropriate
This commit is contained in:
parent
b7926b8582
commit
5288d98376
5 changed files with 15 additions and 14 deletions
|
@ -149,7 +149,6 @@ void Circle3DOverlay::render(RenderArgs* args) {
|
|||
geometryCache->updateVertices(_quadVerticesID, points, color);
|
||||
}
|
||||
|
||||
geometryCache->bindSimpleProgram(batch);
|
||||
geometryCache->renderVertices(batch, gpu::TRIANGLES, _quadVerticesID);
|
||||
|
||||
} else {
|
||||
|
@ -188,8 +187,6 @@ void Circle3DOverlay::render(RenderArgs* args) {
|
|||
geometryCache->updateVertices(_lineVerticesID, points, color);
|
||||
}
|
||||
|
||||
// Render unlit
|
||||
geometryCache->bindSimpleProgram(batch, false, false, true);
|
||||
if (getIsDashedLine()) {
|
||||
geometryCache->renderVertices(batch, gpu::LINES, _lineVerticesID);
|
||||
} else {
|
||||
|
@ -282,10 +279,13 @@ void Circle3DOverlay::render(RenderArgs* args) {
|
|||
}
|
||||
|
||||
const render::ShapeKey Circle3DOverlay::getShapeKey() {
|
||||
auto builder = render::ShapeKey::Builder().withOwnPipeline();
|
||||
auto builder = render::ShapeKey::Builder().withoutCullFace();
|
||||
if (getAlpha() != 1.0f) {
|
||||
builder.withTranslucent();
|
||||
}
|
||||
if (!getIsSolid()) {
|
||||
builder.withUnlit().withDepthBias();
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,6 @@ void Cube3DOverlay::render(RenderArgs* args) {
|
|||
Transform transform;
|
||||
transform.setTranslation(position);
|
||||
transform.setRotation(rotation);
|
||||
|
||||
auto geometryCache = DependencyManager::get<GeometryCache>();
|
||||
auto pipeline = args->_pipeline;
|
||||
if (!pipeline) {
|
||||
|
@ -97,10 +96,13 @@ void Cube3DOverlay::render(RenderArgs* args) {
|
|||
}
|
||||
|
||||
const render::ShapeKey Cube3DOverlay::getShapeKey() {
|
||||
auto builder = render::ShapeKey::Builder().withOwnPipeline();
|
||||
auto builder = render::ShapeKey::Builder();
|
||||
if (getAlpha() != 1.0f) {
|
||||
builder.withTranslucent();
|
||||
}
|
||||
if (!getIsSolid()) {
|
||||
builder.withUnlit().withDepthBias();
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
|
|
|
@ -75,11 +75,9 @@ void Grid3DOverlay::render(RenderArgs* args) {
|
|||
transform.setScale(glm::vec3(getDimensions(), 1.0f));
|
||||
transform.setTranslation(position);
|
||||
batch->setModelTransform(transform);
|
||||
auto geometryCache = DependencyManager::get<GeometryCache>();
|
||||
geometryCache->bindSimpleProgram(*batch, false, false, true, true);
|
||||
const float MINOR_GRID_EDGE = 0.0025f;
|
||||
const float MAJOR_GRID_EDGE = 0.005f;
|
||||
geometryCache->renderGrid(*batch, minCorner, maxCorner,
|
||||
DependencyManager::get<GeometryCache>()->renderGrid(*batch, minCorner, maxCorner,
|
||||
_minorGridRowDivisions, _minorGridColDivisions, MINOR_GRID_EDGE,
|
||||
_majorGridRowDivisions, _majorGridColDivisions, MAJOR_GRID_EDGE,
|
||||
gridColor, _drawInFront);
|
||||
|
@ -87,7 +85,7 @@ void Grid3DOverlay::render(RenderArgs* args) {
|
|||
}
|
||||
|
||||
const render::ShapeKey Grid3DOverlay::getShapeKey() {
|
||||
return render::ShapeKey::Builder().withOwnPipeline();
|
||||
return render::ShapeKey::Builder().withOwnPipeline().withUnlit().withDepthBias();
|
||||
}
|
||||
|
||||
void Grid3DOverlay::setProperties(const QVariantMap& properties) {
|
||||
|
|
|
@ -93,9 +93,7 @@ void Image3DOverlay::render(RenderArgs* args) {
|
|||
batch->setModelTransform(transform);
|
||||
batch->setResourceTexture(0, _texture->getGPUTexture());
|
||||
|
||||
auto geometryCache = DependencyManager::get<GeometryCache>();
|
||||
geometryCache->bindSimpleProgram(*batch, true, false);
|
||||
geometryCache->renderQuad(
|
||||
DependencyManager::get<GeometryCache>()->renderQuad(
|
||||
*batch, topLeft, bottomRight, texCoordTopLeft, texCoordBottomRight,
|
||||
glm::vec4(color.red / MAX_COLOR, color.green / MAX_COLOR, color.blue / MAX_COLOR, alpha)
|
||||
);
|
||||
|
@ -104,7 +102,7 @@ void Image3DOverlay::render(RenderArgs* args) {
|
|||
}
|
||||
|
||||
const render::ShapeKey Image3DOverlay::getShapeKey() {
|
||||
auto builder = render::ShapeKey::Builder().withOwnPipeline();
|
||||
auto builder = render::ShapeKey::Builder().withoutCullFace().withDepthBias();
|
||||
if (_emissive) {
|
||||
builder.withUnlit();
|
||||
}
|
||||
|
|
|
@ -62,6 +62,9 @@ const render::ShapeKey Sphere3DOverlay::getShapeKey() {
|
|||
if (getAlpha() != 1.0f) {
|
||||
builder.withTranslucent();
|
||||
}
|
||||
if (!getIsSolid()) {
|
||||
builder.withUnlit().withDepthBias();
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue