mirror of
https://github.com/lubosz/overte.git
synced 2025-04-24 09:23:17 +02:00
Merge remote-tracking branch 'upstream/master' into HEAD
This commit is contained in:
commit
56f625d376
12 changed files with 101 additions and 43 deletions
|
@ -181,15 +181,33 @@ Item {
|
|||
color: root.fontColor;
|
||||
font.pixelSize: root.fontSize
|
||||
visible: root.expanded;
|
||||
text: "\tMesh Parts Rendered Opaque: " + root.meshOpaque +
|
||||
" / Translucent: " + root.meshTranslucent;
|
||||
text: "\tItems Rendered Opaque: " + root.opaqueRendered +
|
||||
" / Translucent: " + root.translucentRendered +
|
||||
" / Other: " + root.otherRendered;
|
||||
}
|
||||
Text {
|
||||
color: root.fontColor;
|
||||
font.pixelSize: root.fontSize
|
||||
visible: root.expanded;
|
||||
text: "\tOpaque considered: " + root.opaqueConsidered +
|
||||
" / Out of view: " + root.opaqueOutOfView + " / Too small: " + root.opaqueTooSmall;
|
||||
" / Out of view: " + root.opaqueOutOfView +
|
||||
" / Too small: " + root.opaqueTooSmall;
|
||||
}
|
||||
Text {
|
||||
color: root.fontColor;
|
||||
font.pixelSize: root.fontSize
|
||||
visible: root.expanded;
|
||||
text: "\tTranslucent considered: " + root.translucentConsidered +
|
||||
" / Out of view: " + root.translucentOutOfView +
|
||||
" / Too small: " + root.translucentTooSmall;
|
||||
}
|
||||
Text {
|
||||
color: root.fontColor;
|
||||
font.pixelSize: root.fontSize
|
||||
visible: root.expanded;
|
||||
text: "\tOther considered: " + root.otherConsidered +
|
||||
" / Out of view: " + root.otherOutOfView +
|
||||
" / Too small: " + root.otherTooSmall;
|
||||
}
|
||||
Text {
|
||||
color: root.fontColor;
|
||||
|
|
|
@ -229,7 +229,6 @@ bool LODManager::shouldRender(const RenderArgs* args, const AABox& bounds) {
|
|||
static bool shouldRenderTableNeedsBuilding = true;
|
||||
static QMap<float, float> shouldRenderTable;
|
||||
if (shouldRenderTableNeedsBuilding) {
|
||||
|
||||
float SMALLEST_SCALE_IN_TABLE = 0.001f; // 1mm is plenty small
|
||||
float scale = maxScale;
|
||||
float factor = 1.0f;
|
||||
|
@ -254,7 +253,7 @@ bool LODManager::shouldRender(const RenderArgs* args, const AABox& bounds) {
|
|||
if (closestScale < largestDimension) {
|
||||
visibleDistanceAtClosestScale *= 2.0f;
|
||||
}
|
||||
|
||||
|
||||
return distanceToCamera <= visibleDistanceAtClosestScale;
|
||||
};
|
||||
|
||||
|
|
|
@ -342,14 +342,18 @@ void Stats::setRenderDetails(const RenderDetails& details) {
|
|||
STAT_UPDATE(triangles, details._trianglesRendered);
|
||||
STAT_UPDATE(materialSwitches, details._materialSwitches);
|
||||
if (_expanded) {
|
||||
STAT_UPDATE(meshOpaque, details._opaque._rendered);
|
||||
STAT_UPDATE(meshTranslucent, details._opaque._rendered);
|
||||
STAT_UPDATE(opaqueConsidered, details._opaque._considered);
|
||||
STAT_UPDATE(opaqueOutOfView, details._opaque._outOfView);
|
||||
STAT_UPDATE(opaqueTooSmall, details._opaque._tooSmall);
|
||||
STAT_UPDATE(opaqueRendered, details._opaque._rendered);
|
||||
STAT_UPDATE(translucentConsidered, details._translucent._considered);
|
||||
STAT_UPDATE(translucentOutOfView, details._translucent._outOfView);
|
||||
STAT_UPDATE(translucentTooSmall, details._translucent._tooSmall);
|
||||
STAT_UPDATE(translucentRendered, details._translucent._rendered);
|
||||
STAT_UPDATE(otherConsidered, details._other._considered);
|
||||
STAT_UPDATE(otherOutOfView, details._other._outOfView);
|
||||
STAT_UPDATE(otherTooSmall, details._other._tooSmall);
|
||||
STAT_UPDATE(otherRendered, details._other._rendered);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -58,14 +58,18 @@ class Stats : public QQuickItem {
|
|||
STATS_PROPERTY(int, triangles, 0)
|
||||
STATS_PROPERTY(int, quads, 0)
|
||||
STATS_PROPERTY(int, materialSwitches, 0)
|
||||
STATS_PROPERTY(int, meshOpaque, 0)
|
||||
STATS_PROPERTY(int, meshTranslucent, 0)
|
||||
STATS_PROPERTY(int, opaqueConsidered, 0)
|
||||
STATS_PROPERTY(int, opaqueOutOfView, 0)
|
||||
STATS_PROPERTY(int, opaqueTooSmall, 0)
|
||||
STATS_PROPERTY(int, opaqueRendered, 0)
|
||||
STATS_PROPERTY(int, translucentConsidered, 0)
|
||||
STATS_PROPERTY(int, translucentOutOfView, 0)
|
||||
STATS_PROPERTY(int, translucentTooSmall, 0)
|
||||
STATS_PROPERTY(int, translucentRendered, 0)
|
||||
STATS_PROPERTY(int, otherConsidered, 0)
|
||||
STATS_PROPERTY(int, otherOutOfView, 0)
|
||||
STATS_PROPERTY(int, otherTooSmall, 0)
|
||||
STATS_PROPERTY(int, otherRendered, 0)
|
||||
STATS_PROPERTY(QString, sendingMode, QString())
|
||||
STATS_PROPERTY(QString, packetStats, QString())
|
||||
STATS_PROPERTY(QString, lodStatus, QString())
|
||||
|
@ -135,14 +139,18 @@ signals:
|
|||
void trianglesChanged();
|
||||
void quadsChanged();
|
||||
void materialSwitchesChanged();
|
||||
void meshOpaqueChanged();
|
||||
void meshTranslucentChanged();
|
||||
void opaqueConsideredChanged();
|
||||
void opaqueOutOfViewChanged();
|
||||
void opaqueTooSmallChanged();
|
||||
void opaqueRenderedChanged();
|
||||
void translucentConsideredChanged();
|
||||
void translucentOutOfViewChanged();
|
||||
void translucentTooSmallChanged();
|
||||
void translucentRenderedChanged();
|
||||
void otherConsideredChanged();
|
||||
void otherOutOfViewChanged();
|
||||
void otherTooSmallChanged();
|
||||
void otherRenderedChanged();
|
||||
void sendingModeChanged();
|
||||
void packetStatsChanged();
|
||||
void lodStatusChanged();
|
||||
|
|
|
@ -745,10 +745,18 @@ FBXGeometry* FBXReader::extractFBXGeometry(const QVariantHash& mapping, const QS
|
|||
|
||||
// see FBX documentation, http://download.autodesk.com/us/fbx/20112/FBX_SDK_HELP/index.html
|
||||
model.translation = translation;
|
||||
|
||||
model.preTransform = glm::translate(rotationOffset) * glm::translate(rotationPivot);
|
||||
model.preRotation = glm::quat(glm::radians(preRotation));
|
||||
model.rotation = glm::quat(glm::radians(rotation));
|
||||
model.postRotation = glm::quat(glm::radians(postRotation));
|
||||
|
||||
if (geometry.applicationName.startsWith("Blender")) {
|
||||
// blender puts the jointOffset in the wrong place.
|
||||
model.preRotation = model.rotation;
|
||||
model.rotation = glm::quat();
|
||||
}
|
||||
|
||||
model.postTransform = glm::translate(-rotationPivot) * glm::translate(scaleOffset) *
|
||||
glm::translate(scalePivot) * glm::scale(scale) * glm::translate(-scalePivot);
|
||||
// NOTE: angles from the FBX file are in degrees
|
||||
|
|
|
@ -186,6 +186,8 @@ double mapComponent(double sobelValue) {
|
|||
gpu::Texture* TextureUsage::createNormalTextureFromBumpImage(const QImage& srcImage, const std::string& srcImageName) {
|
||||
QImage image = srcImage;
|
||||
|
||||
|
||||
#if 0
|
||||
// PR 5540 by AlessandroSigna
|
||||
// integrated here as a specialized TextureLoader for bumpmaps
|
||||
// The conversion is done using the Sobel Filter to calculate the derivatives from the grayscale image
|
||||
|
@ -236,6 +238,7 @@ gpu::Texture* TextureUsage::createNormalTextureFromBumpImage(const QImage& srcIm
|
|||
result.setPixel(i, j, qRgbValue);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
gpu::Texture* theTexture = nullptr;
|
||||
if ((image.width() > 0) && (image.height() > 0)) {
|
||||
|
|
|
@ -89,11 +89,9 @@ render::ItemKey MeshPartPayload::getKey() const {
|
|||
}
|
||||
|
||||
render::Item::Bound MeshPartPayload::getBound() const {
|
||||
if (_isBoundInvalid) {
|
||||
model->getPartBounds(meshIndex, partIndex);
|
||||
_isBoundInvalid = false;
|
||||
}
|
||||
return _bound;
|
||||
// NOTE: we can't cache this bounds because we need to handle the case of a moving
|
||||
// entity or mesh part.
|
||||
return model->getPartBounds(meshIndex, partIndex);
|
||||
}
|
||||
|
||||
void MeshPartPayload::drawCall(gpu::Batch& batch) const {
|
||||
|
|
|
@ -55,9 +55,6 @@ public:
|
|||
bool _hasColorAttrib = false;
|
||||
bool _isSkinned = false;
|
||||
bool _isBlendShaped = false;
|
||||
|
||||
mutable render::Item::Bound _bound;
|
||||
mutable bool _isBoundInvalid = true;
|
||||
};
|
||||
|
||||
namespace render {
|
||||
|
|
|
@ -76,7 +76,7 @@ RenderDeferredTask::RenderDeferredTask() : Task() {
|
|||
}
|
||||
)
|
||||
)));
|
||||
_jobs.push_back(Job(new CullItems::JobModel("CullOpaque", _jobs.back().getOutput())));
|
||||
_jobs.push_back(Job(new CullItemsOpaque::JobModel("CullOpaque", _jobs.back().getOutput())));
|
||||
_jobs.push_back(Job(new DepthSortItems::JobModel("DepthSortOpaque", _jobs.back().getOutput())));
|
||||
auto& renderedOpaques = _jobs.back().getOutput();
|
||||
_jobs.push_back(Job(new DrawOpaqueDeferred::JobModel("DrawOpaqueDeferred", _jobs.back().getOutput())));
|
||||
|
@ -105,7 +105,9 @@ RenderDeferredTask::RenderDeferredTask() : Task() {
|
|||
}
|
||||
)
|
||||
)));
|
||||
_jobs.push_back(Job(new CullItems::JobModel("CullTransparent", _jobs.back().getOutput())));
|
||||
_jobs.push_back(Job(new CullItemsTransparent::JobModel("CullTransparent", _jobs.back().getOutput())));
|
||||
|
||||
|
||||
_jobs.push_back(Job(new DepthSortItems::JobModel("DepthSortTransparent", _jobs.back().getOutput(), DepthSortItems(false))));
|
||||
_jobs.push_back(Job(new DrawTransparentDeferred::JobModel("TransparentDeferred", _jobs.back().getOutput())));
|
||||
|
||||
|
|
|
@ -115,6 +115,26 @@ void CullItems::run(const SceneContextPointer& sceneContext, const RenderContext
|
|||
|
||||
outItems.clear();
|
||||
outItems.reserve(inItems.size());
|
||||
RenderArgs* args = renderContext->args;
|
||||
args->_details.pointTo(RenderDetails::OTHER_ITEM);
|
||||
cullItems(sceneContext, renderContext, inItems, outItems);
|
||||
}
|
||||
|
||||
void CullItemsOpaque::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemIDsBounds& inItems, ItemIDsBounds& outItems) {
|
||||
|
||||
outItems.clear();
|
||||
outItems.reserve(inItems.size());
|
||||
RenderArgs* args = renderContext->args;
|
||||
args->_details.pointTo(RenderDetails::OPAQUE_ITEM);
|
||||
cullItems(sceneContext, renderContext, inItems, outItems);
|
||||
}
|
||||
|
||||
void CullItemsTransparent::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemIDsBounds& inItems, ItemIDsBounds& outItems) {
|
||||
|
||||
outItems.clear();
|
||||
outItems.reserve(inItems.size());
|
||||
RenderArgs* args = renderContext->args;
|
||||
args->_details.pointTo(RenderDetails::TRANSLUCENT_ITEM);
|
||||
cullItems(sceneContext, renderContext, inItems, outItems);
|
||||
}
|
||||
|
||||
|
@ -233,9 +253,10 @@ void DrawLight::run(const SceneContextPointer& sceneContext, const RenderContext
|
|||
|
||||
ItemIDsBounds culledItems;
|
||||
culledItems.reserve(inItems.size());
|
||||
RenderArgs* args = renderContext->args;
|
||||
args->_details.pointTo(RenderDetails::OTHER_ITEM);
|
||||
cullItems(sceneContext, renderContext, inItems, culledItems);
|
||||
|
||||
RenderArgs* args = renderContext->args;
|
||||
gpu::doInBatch(args->_context, [=](gpu::Batch& batch) {
|
||||
args->_batch = &batch;
|
||||
renderItems(sceneContext, renderContext, culledItems);
|
||||
|
|
|
@ -231,10 +231,21 @@ public:
|
|||
class CullItems {
|
||||
public:
|
||||
void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemIDsBounds& inItems, ItemIDsBounds& outItems);
|
||||
|
||||
typedef Job::ModelIO<CullItems, ItemIDsBounds, ItemIDsBounds> JobModel;
|
||||
};
|
||||
|
||||
class CullItemsOpaque {
|
||||
public:
|
||||
void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemIDsBounds& inItems, ItemIDsBounds& outItems);
|
||||
typedef Job::ModelIO<CullItemsOpaque, ItemIDsBounds, ItemIDsBounds> JobModel;
|
||||
};
|
||||
|
||||
class CullItemsTransparent {
|
||||
public:
|
||||
void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemIDsBounds& inItems, ItemIDsBounds& outItems);
|
||||
typedef Job::ModelIO<CullItemsTransparent, ItemIDsBounds, ItemIDsBounds> JobModel;
|
||||
};
|
||||
|
||||
class DepthSortItems {
|
||||
public:
|
||||
bool _frontToBack = true;
|
||||
|
|
|
@ -156,29 +156,18 @@ void vhacd::VHACDUtil::fattenMeshes(const FBXMesh& mesh, FBXMesh& result,
|
|||
AABox getAABoxForMeshPart(const FBXMesh& mesh, const FBXMeshPart &meshPart) {
|
||||
AABox aaBox;
|
||||
unsigned int triangleCount = meshPart.triangleIndices.size() / 3;
|
||||
for (unsigned int i = 0; i < triangleCount; i++) {
|
||||
glm::vec3 p0 = mesh.vertices[meshPart.triangleIndices[i * 3]];
|
||||
glm::vec3 p1 = mesh.vertices[meshPart.triangleIndices[i * 3 + 1]];
|
||||
glm::vec3 p2 = mesh.vertices[meshPart.triangleIndices[i * 3 + 2]];
|
||||
aaBox += p0;
|
||||
aaBox += p1;
|
||||
aaBox += p2;
|
||||
for (unsigned int i = 0; i < triangleCount; ++i) {
|
||||
aaBox += mesh.vertices[meshPart.triangleIndices[i * 3]];
|
||||
aaBox += mesh.vertices[meshPart.triangleIndices[i * 3 + 1]];
|
||||
aaBox += mesh.vertices[meshPart.triangleIndices[i * 3 + 2]];
|
||||
}
|
||||
|
||||
unsigned int quadCount = meshPart.quadIndices.size() / 4;
|
||||
for (unsigned int i = 0; i < quadCount; i++) {
|
||||
unsigned int p0Index = meshPart.quadIndices[i * 4];
|
||||
unsigned int p1Index = meshPart.quadIndices[i * 4 + 1];
|
||||
unsigned int p2Index = meshPart.quadIndices[i * 4 + 2];
|
||||
unsigned int p3Index = meshPart.quadIndices[i * 4 + 3];
|
||||
glm::vec3 p0 = mesh.vertices[p0Index];
|
||||
glm::vec3 p1 = mesh.vertices[p1Index + 1];
|
||||
glm::vec3 p2 = mesh.vertices[p2Index + 2];
|
||||
glm::vec3 p3 = mesh.vertices[p3Index + 3];
|
||||
aaBox += p0;
|
||||
aaBox += p1;
|
||||
aaBox += p2;
|
||||
aaBox += p3;
|
||||
for (unsigned int i = 0; i < quadCount; ++i) {
|
||||
aaBox += mesh.vertices[meshPart.quadIndices[i * 4]];
|
||||
aaBox += mesh.vertices[meshPart.quadIndices[i * 4 + 1]];
|
||||
aaBox += mesh.vertices[meshPart.quadIndices[i * 4 + 2]];
|
||||
aaBox += mesh.vertices[meshPart.quadIndices[i * 4 + 3]];
|
||||
}
|
||||
|
||||
return aaBox;
|
||||
|
|
Loading…
Reference in a new issue