summaryrefslogtreecommitdiffstats
path: root/src/render/renderers/opengl/renderer/renderview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/render/renderers/opengl/renderer/renderview.cpp')
-rw-r--r--src/render/renderers/opengl/renderer/renderview.cpp54
1 files changed, 3 insertions, 51 deletions
diff --git a/src/render/renderers/opengl/renderer/renderview.cpp b/src/render/renderers/opengl/renderer/renderview.cpp
index b00f2c473..420b32325 100644
--- a/src/render/renderers/opengl/renderer/renderview.cpp
+++ b/src/render/renderers/opengl/renderer/renderview.cpp
@@ -632,21 +632,18 @@ QVector<RenderCommand *> RenderView::buildDrawRenderCommands(const QVector<Entit
const Qt3DCore::QNodeId materialComponentId = entity->componentUuid<Material>();
const HMaterial materialHandle = entity->componentHandle<Material>();
const QVector<RenderPassParameterData> renderPassData = m_parameters.value(materialComponentId);
- HGeometry geometryHandle = m_manager->lookupHandle<Geometry, GeometryManager, HGeometry>(geometryRenderer->geometryId());
- Geometry *geometry = m_manager->data<Geometry, GeometryManager>(geometryHandle);
// 1 RenderCommand per RenderPass pass on an Entity with a Mesh
for (const RenderPassParameterData &passData : renderPassData) {
// Add the RenderPass Parameters
RenderCommand *command = new RenderCommand();
+ command->m_geometryRenderer = geometryRendererHandle;
+ command->m_geometry = m_manager->geometryManager()->lookupHandle(geometryRenderer->geometryId());
// Project the camera-to-object-center vector onto the camera
// view vector. This gives a depth value suitable as the key
// for BackToFront sorting.
command->m_depth = Vector3D::dotProduct(entity->worldBoundingVolume()->center() - m_data.m_eyePos, m_data.m_eyeViewDir);
-
- command->m_geometry = geometryHandle;
- command->m_geometryRenderer = geometryRendererHandle;
command->m_material = materialHandle;
// For RenderPass based states we use the globally set RenderState
// if no renderstates are defined as part of the pass. That means:
@@ -686,51 +683,6 @@ QVector<RenderCommand *> RenderView::buildDrawRenderCommands(const QVector<Entit
lightSources.mid(0, std::max(lightSources.size(), MAX_LIGHTS)),
m_environmentLight);
- // Store all necessary information for actual drawing if command is valid
- command->m_isValid = !command->m_attributes.empty();
- if (command->m_isValid) {
- // Update the draw command with what's going to be needed for the drawing
- uint primitiveCount = geometryRenderer->vertexCount();
- uint estimatedCount = 0;
- Attribute *indexAttribute = nullptr;
-
- const QVector<Qt3DCore::QNodeId> attributeIds = geometry->attributes();
- for (Qt3DCore::QNodeId attributeId : attributeIds) {
- Attribute *attribute = m_manager->attributeManager()->lookupResource(attributeId);
- if (attribute->attributeType() == QAttribute::IndexAttribute)
- indexAttribute = attribute;
- else if (command->m_attributes.contains(attribute->nameId()))
- estimatedCount = qMax(attribute->count(), estimatedCount);
- }
-
- // Update the draw command with all the information required for the drawing
- command->m_drawIndexed = (indexAttribute != nullptr);
- if (command->m_drawIndexed) {
- command->m_indexAttributeDataType = GraphicsContext::glDataTypeFromAttributeDataType(indexAttribute->vertexBaseType());
- command->m_indexAttributeByteOffset = indexAttribute->byteOffset();
- }
-
- // Use the count specified by the GeometryRender
- // If not specified use the indexAttribute count if present
- // Otherwise tries to use the count from the attribute with the highest count
- if (primitiveCount == 0) {
- if (indexAttribute)
- primitiveCount = indexAttribute->count();
- else
- primitiveCount = estimatedCount;
- }
-
- command->m_primitiveCount = primitiveCount;
- command->m_primitiveType = geometryRenderer->primitiveType();
- command->m_primitiveRestartEnabled = geometryRenderer->primitiveRestartEnabled();
- command->m_restartIndexValue = geometryRenderer->restartIndexValue();
- command->m_firstInstance = geometryRenderer->firstInstance();
- command->m_instanceCount = geometryRenderer->instanceCount();
- command->m_firstVertex = geometryRenderer->firstVertex();
- command->m_indexOffset = geometryRenderer->indexOffset();
- command->m_verticesPerPatch = geometryRenderer->verticesPerPatch();
- }
-
commands.append(command);
}
}
@@ -1049,7 +1001,7 @@ void RenderView::setShaderAndUniforms(RenderCommand *command,
// Set default attributes
for (const int attributeNameId : attributeNamesIds)
- command->m_attributes.push_back(attributeNameId);
+ command->m_activeAttributes.push_back(attributeNameId);
// Parameters remaining could be
// -> uniform scalar / vector