Details
-
Bug
-
Resolution: Incomplete
-
Not Evaluated
-
None
-
6.3.1
-
None
Description
void Entity::createEntity()
{
QList<Triangle> triangles;
QMap<QPair<int, int>, Vertex> vertexMap = setVertexDataBuffer(triangles);
setIndexDataBuffer(triangles, vertexMap);
if (!m_vertexDataBuffer)
return;
int vCount = m_vertexDataBuffer->data().count() / sizeof(Vertex);
auto positionAttribute = new Attribute();
positionAttribute->setAttributeType(Qt3DRender::QAttribute::VertexAttribute);
positionAttribute->setBuffer(m_vertexDataBuffer);
positionAttribute->setVertexBaseType(Qt3DRender::QAttribute::Float);
positionAttribute->setVertexSize(3);
positionAttribute->setByteOffset(Vertex::positionOffset());
positionAttribute->setByteStride(sizeof(Vertex));
if (m_type == C::CrossHair)
positionAttribute->setCount(6);
else
positionAttribute->setCount(vCount);
positionAttribute->setName(Qt3DRender::QAttribute::defaultPositionAttributeName());
Qt3DRender::QAttribute* normalAttribute = nullptr;
if (!triangles.isEmpty())
auto colorAttribute = new Qt3DRender::QAttribute();
colorAttribute->setAttributeType(Qt3DRender::QAttribute::VertexAttribute);
colorAttribute->setBuffer(m_vertexDataBuffer);
colorAttribute->setVertexBaseType(Qt3DRender::QAttribute::Float);
colorAttribute->setVertexSize(4);
colorAttribute->setByteOffset(Vertex::colorOffset());
colorAttribute->setByteStride(sizeof(Vertex));
if (m_type == C::CrossHair)
colorAttribute->setCount(6);
else
colorAttribute->setCount(vCount);
colorAttribute->setName(Qt3DRender::QAttribute::defaultColorAttributeName());
Qt3DRender::QAttribute* indexAttribute = nullptr;
if (m_indexDataBuffer)
auto customGeometry = new Qt3DRender::QGeometry();
customGeometry->addAttribute(positionAttribute);
customGeometry->addAttribute(colorAttribute);
if (normalAttribute)
customGeometry->addAttribute(normalAttribute);
if (indexAttribute)
customGeometry->addAttribute(indexAttribute);
//createBoundingVolumePositionAttribute(customGeometry);
auto customMeshRenderer = new Qt3DRender::QGeometryRenderer;
if (type() == C::HorizonT0)
else if (type() == C::CrossHair)
customMeshRenderer->setPrimitiveType(Qt3DRender::QGeometryRenderer::Lines);
else if (type() == C::InLine || type() == C::CrossLine ||
type() == C::Traverse || type() == C::TimeSlice)
else
customMeshRenderer->setPrimitiveType(Qt3DRender::QGeometryRenderer::Triangles);
customMeshRenderer->setGeometry(customGeometry);
auto material = new Qt3DExtras::QPerVertexColorMaterial();
if (type() != C::HorizonT0 && type() != C::CrossHair)
if (type() == C::HorizonSlice || type() == C::InLine || type() == C::CrossLine ||
type() == C::Traverse || type() == C::TimeSlice)
if (type() == C::Passage && (id() == C::Roof || id() == C::Floor))
{ auto offset = new Qt3DRender::QPolygonOffset(); offset->setScaleFactor(1.5f); offset->setDepthSteps(1.0f); material->effect()->techniques()[0]->renderPasses()[0]->addRenderState(offset); }auto cullFront = new Qt3DRender::QCullFace();
cullFront->setMode(Qt3DRender::QCullFace::NoCulling);
material->effect()>techniques()[0]>renderPasses()[0]->addRenderState(cullFront);
auto lineWidth = new Qt3DRender::QLineWidth();
lineWidth->smooth();
lineWidth->setValue(2.0f);
material->effect()>techniques()[0]>renderPasses()[0]->addRenderState(lineWidth);
addComponent(customMeshRenderer);
addComponent(material);
if (type() == C::CrossHair)
setEnabled(false);
else
addComponent(m_modifier->m_transform);
if (type() == C::Passage && (id() == C::Roof || id() == C::Floor))
{ if (m_modifier->pickEnabled()) addComponent(m_modifier->m_picker); createWireframe(vertexMap); }}
auto cullFront = new Qt3DRender::QCullFace();auto cullFront = new Qt3DRender::QCullFace(); cullFront->setMode(Qt3DRender::QCullFace::NoCulling); material->effect()>techniques()[0]>renderPasses()[0]->addRenderState(cullFront);
auto lineWidth = new Qt3DRender::QLineWidth(); lineWidth->smooth(); lineWidth->setValue(2.0f); material->effect()>techniques()[0]>renderPasses()[0]->addRenderState(lineWidth);
在Qt6下cullFront 和lineWidth没有效果