mirror of
https://github.com/lubosz/overte.git
synced 2025-04-07 16:42:08 +02:00
INstrumenting the code more...
This commit is contained in:
parent
3e3c4c2e70
commit
dc40c530a3
10 changed files with 128 additions and 127 deletions
|
@ -11,6 +11,9 @@
|
|||
#include "RenderPipelines.h"
|
||||
#include "GeometryCache.h"
|
||||
|
||||
#include "EntitiesRendererLogging.h"
|
||||
|
||||
|
||||
using namespace render;
|
||||
using namespace render::entities;
|
||||
|
||||
|
@ -195,7 +198,10 @@ void MaterialEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPo
|
|||
auto material = getMaterial();
|
||||
bool newTexturesLoaded = material ? !material->isMissingTexture() : false;
|
||||
if (!_texturesLoaded && newTexturesLoaded) {
|
||||
material->checkResetOpacityMap();
|
||||
bool changed = material->checkResetOpacityMap();
|
||||
if (changed) {
|
||||
qCWarning(entitiesrenderer) << "opacity change detected for material " << material->getName().c_str();
|
||||
}
|
||||
}
|
||||
_texturesLoaded = newTexturesLoaded;
|
||||
}
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
|
||||
#include <Transform.h>
|
||||
|
||||
#include "GraphicsLogging.h"
|
||||
|
||||
using namespace graphics;
|
||||
using namespace gpu;
|
||||
|
||||
|
@ -162,7 +164,8 @@ void Material::setTextureMap(MapChannel channel, const TextureMapPointer& textur
|
|||
|
||||
}
|
||||
|
||||
void Material::resetOpacityMap() const {
|
||||
bool Material::resetOpacityMap() const {
|
||||
auto previous = _key.getAlphaMapMode();
|
||||
// Clear the previous flags
|
||||
_key.setOpacityMaskMap(false);
|
||||
_key.setTranslucentMap(false);
|
||||
|
@ -186,6 +189,12 @@ void Material::resetOpacityMap() const {
|
|||
}
|
||||
}
|
||||
}
|
||||
auto newious = _key.getAlphaMapMode();
|
||||
if (previous != newious) {
|
||||
qCWarning(graphicsLog) << "opacity change detected for material " << _name.c_str();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
const TextureMapPointer Material::getTextureMap(MapChannel channel) const {
|
||||
|
|
|
@ -358,7 +358,8 @@ public:
|
|||
|
||||
// Albedo maps cannot have opacity detected until they are loaded
|
||||
// This method allows const changing of the key/schemaBuffer without touching the map
|
||||
void resetOpacityMap() const;
|
||||
// return true if the opacity changed, flase otherwise
|
||||
bool resetOpacityMap() const;
|
||||
|
||||
// conversion from legacy material properties to PBR equivalent
|
||||
static float shininessToRoughness(float shininess) { return 1.0f - shininess / 100.0f; }
|
||||
|
|
|
@ -748,13 +748,14 @@ bool NetworkMaterial::isMissingTexture() {
|
|||
return false;
|
||||
}
|
||||
|
||||
void NetworkMaterial::checkResetOpacityMap() {
|
||||
bool NetworkMaterial::checkResetOpacityMap() {
|
||||
// If material textures are loaded, check the material translucency
|
||||
// FIXME: This should not be done here. The opacity map should already be reset in Material::setTextureMap.
|
||||
// However, currently that code can be called before the albedo map is defined, so resetOpacityMap will fail.
|
||||
// Geometry::areTexturesLoaded() is called repeatedly until it returns true, so we do the check here for now
|
||||
const auto& albedoTexture = _textures[NetworkMaterial::MapChannel::ALBEDO_MAP];
|
||||
if (albedoTexture.texture) {
|
||||
resetOpacityMap();
|
||||
return resetOpacityMap();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ public:
|
|||
void setLightMap(const QUrl& url);
|
||||
|
||||
bool isMissingTexture();
|
||||
void checkResetOpacityMap();
|
||||
bool checkResetOpacityMap();
|
||||
|
||||
class Texture {
|
||||
public:
|
||||
|
|
|
@ -472,7 +472,10 @@ bool Geometry::areTexturesLoaded() const {
|
|||
return false;
|
||||
}
|
||||
|
||||
material->checkResetOpacityMap();
|
||||
bool changed = material->checkResetOpacityMap();
|
||||
if (changed) {
|
||||
qCWarning(modelnetworking) << "Material list: opacity change detected for material " << material->getName().c_str();
|
||||
}
|
||||
}
|
||||
|
||||
for (auto& materialMapping : _materialMapping) {
|
||||
|
@ -483,7 +486,10 @@ bool Geometry::areTexturesLoaded() const {
|
|||
return false;
|
||||
}
|
||||
|
||||
materialPair.second->checkResetOpacityMap();
|
||||
bool changed = materialPair.second->checkResetOpacityMap();
|
||||
if (changed) {
|
||||
qCWarning(modelnetworking) << "Mapping list: opacity change detected for material " << materialPair.first.c_str();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
15
scripts/developer/utilities/cache/cash.qml
vendored
15
scripts/developer/utilities/cache/cash.qml
vendored
|
@ -109,21 +109,6 @@ Rectangle {
|
|||
}
|
||||
width:column.width
|
||||
}
|
||||
|
||||
Prop.PropScalar {
|
||||
label: "Texture Loading"
|
||||
object: TextureCache
|
||||
property: "numLoading"
|
||||
integral: true
|
||||
readOnly: true
|
||||
}
|
||||
Prop.PropScalar {
|
||||
label: "Model Loading"
|
||||
object: ModelCache
|
||||
property: "numLoading"
|
||||
integral: true
|
||||
readOnly: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,14 +63,13 @@ Item {
|
|||
}
|
||||
|
||||
|
||||
/* Timer {
|
||||
Timer {
|
||||
interval: 2000; running: true; repeat: true
|
||||
onTriggered: pullFreshValues()
|
||||
}*/
|
||||
}
|
||||
|
||||
function pullFreshValues() {
|
||||
if (needFreshList) {
|
||||
//console.log("Updating " + cacheResourceName + "cache list")
|
||||
updateItemList(fetchItemsList())
|
||||
needFreshList = false
|
||||
}
|
||||
|
@ -127,7 +126,9 @@ Item {
|
|||
var item = itemList[i]
|
||||
currentItemsList.push(item)
|
||||
resourceItemsModel.append(packItemEntry(item, currentItemsList.length -1))
|
||||
}
|
||||
}
|
||||
// At the end of it, force an update
|
||||
visualModel.forceUpdate()
|
||||
}
|
||||
|
||||
function updateItemList(newItemList) {
|
||||
|
@ -148,6 +149,7 @@ Item {
|
|||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
height: totalCount.height
|
||||
id: headerTop
|
||||
|
||||
Prop.PropButton {
|
||||
id: refreshButton
|
||||
|
@ -158,30 +160,46 @@ Item {
|
|||
onPressed: { pullFreshValues() }
|
||||
}
|
||||
|
||||
Item {
|
||||
GridLayout {
|
||||
anchors.left: refreshButton.right
|
||||
anchors.right: parent.right
|
||||
Prop.PropScalar {
|
||||
id: totalCount
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.horizontalCenter
|
||||
label: "Count"
|
||||
object: root.cache
|
||||
property: "numTotal"
|
||||
integral: true
|
||||
readOnly: true
|
||||
onSourceValueVarChanged: { updateItemListFromCache() }
|
||||
id: headerCountLane
|
||||
columns: 3
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
Prop.PropScalar {
|
||||
id: itemCount
|
||||
label: "Count"
|
||||
object: root.cache
|
||||
property: "numTotal"
|
||||
integral: true
|
||||
readOnly: true
|
||||
}
|
||||
}
|
||||
Prop.PropScalar {
|
||||
id: cachedCount
|
||||
anchors.left: parent.horizontalCenter
|
||||
anchors.right: parent.right
|
||||
label: "Cached"
|
||||
object: root.cache
|
||||
property: "numCached"
|
||||
integral: true
|
||||
readOnly: true
|
||||
onSourceValueVarChanged: { updateItemListFromCache() }
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
Prop.PropScalar {
|
||||
id: totalCount
|
||||
label: "Count"
|
||||
object: root.cache
|
||||
property: "numTotal"
|
||||
integral: true
|
||||
readOnly: true
|
||||
onSourceValueVarChanged: { updateItemListFromCache() }
|
||||
}
|
||||
}
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
Prop.PropScalar {
|
||||
id: cachedCount
|
||||
label: "Cached"
|
||||
object: root.cache
|
||||
property: "numCached"
|
||||
integral: true
|
||||
readOnly: true
|
||||
onSourceValueVarChanged: { updateItemListFromCache() }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -331,7 +349,7 @@ Item {
|
|||
//console.log("refreshFilter! token = " + textFilter + " field = " + filterField)
|
||||
acceptItem = acceptItemArray[(textFilter.length != 0) * + (1 + filterField)]
|
||||
}
|
||||
|
||||
|
||||
delegate: resouceItemDelegate
|
||||
}
|
||||
|
||||
|
|
|
@ -6,96 +6,71 @@ DelegateModel {
|
|||
|
||||
property var lessThan: function(left, right) { return true; }
|
||||
property var acceptItem: function(item) { return true; }
|
||||
/*
|
||||
function insertPosition(lessThan, item) {
|
||||
var lower = 0
|
||||
var upper = items.count
|
||||
while (lower < upper) {
|
||||
var middle = Math.floor(lower + (upper - lower) / 2)
|
||||
var result = lessThan(item.model, items.get(middle).model);
|
||||
if (result) {
|
||||
upper = middle
|
||||
} else {
|
||||
lower = middle + 1
|
||||
}
|
||||
}
|
||||
return lower
|
||||
}
|
||||
|
||||
function sort(lessThan) {
|
||||
while (unsortedItems.count > 0) {
|
||||
var item = unsortedItems.get(0)
|
||||
|
||||
var index = insertPosition(lessThan, item)
|
||||
|
||||
item.groups = "items"
|
||||
items.move(item.itemsIndex, index)
|
||||
function insertPosition(lessThanFunctor, item) {
|
||||
var lower = 0
|
||||
var upper = visibleItems.count
|
||||
while (lower < upper) {
|
||||
var middle = Math.floor(lower + (upper - lower) / 2)
|
||||
var result = lessThanFunctor(item.model, visibleItems.get(middle).model);
|
||||
if (result) {
|
||||
upper = middle
|
||||
} else {
|
||||
lower = middle + 1
|
||||
}
|
||||
}
|
||||
*/
|
||||
function insertPosition(lessThanFunctor, item) {
|
||||
var lower = 0
|
||||
var upper = visibleItems.count
|
||||
while (lower < upper) {
|
||||
var middle = Math.floor(lower + (upper - lower) / 2)
|
||||
var result = lessThanFunctor(item.model, visibleItems.get(middle).model);
|
||||
if (result) {
|
||||
upper = middle
|
||||
} else {
|
||||
lower = middle + 1
|
||||
}
|
||||
}
|
||||
return lower
|
||||
}
|
||||
return lower
|
||||
}
|
||||
|
||||
function sort(lessThanFunctor, acceptItemFunctor) {
|
||||
while (unsortedItems.count > 0) {
|
||||
var item = unsortedItems.get(0)
|
||||
|
||||
if (acceptItemFunctor(item.model)) {
|
||||
var index = insertPosition(lessThanFunctor, item)
|
||||
function sortAndFilter(lessThanFunctor, acceptItemFunctor) {
|
||||
while (unsortedItems.count > 0) {
|
||||
var item = unsortedItems.get(0)
|
||||
|
||||
if (acceptItemFunctor(item.model)) {
|
||||
var index = insertPosition(lessThanFunctor, item)
|
||||
|
||||
item.groups = ["items","visible"]
|
||||
visibleItems.move(item.visibleIndex, index)
|
||||
} else {
|
||||
item.groups = ["items"]
|
||||
}
|
||||
item.groups = ["items","visible"]
|
||||
visibleItems.move(item.visibleIndex, index)
|
||||
} else {
|
||||
item.groups = ["items"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Private bool to track when items changed and view is dirty
|
||||
property bool itemsDirty: true
|
||||
function update() {
|
||||
console.log("SortFilterMode: update and sort and filter items !!" + items.count);
|
||||
if (items.count > 0) {
|
||||
items.setGroups(0, items.count, ["items","unsorted"]);
|
||||
}
|
||||
|
||||
sort(lessThan, acceptItem)
|
||||
/*
|
||||
// Step 1: Filter items
|
||||
var visible = [];
|
||||
for (var i = 0; i < items.count; ++i) {
|
||||
var item = items.get(i);
|
||||
if (filterAcceptsItem(item.model)) {
|
||||
visible.push(item);
|
||||
}
|
||||
}
|
||||
|
||||
// Step 2: Sort the list of visible items
|
||||
visible.sort(function(a, b) {
|
||||
return lessThan(a.model, b.model) ? -1 : 1;
|
||||
});
|
||||
|
||||
// Step 3: Add all items to the visible group:
|
||||
for (i = 0; i < visible.length; ++i) {
|
||||
item = visible[i];
|
||||
item.inVisible = true;
|
||||
if (item.visibleIndex !== i) {
|
||||
visibleItems.move(item.visibleIndex, i, 1);
|
||||
}
|
||||
}
|
||||
*/
|
||||
sortAndFilter(lessThan, acceptItem)
|
||||
itemsDirty = false;
|
||||
itemsUpdated()
|
||||
}
|
||||
|
||||
items.onChanged: update()
|
||||
signal itemsUpdated()
|
||||
|
||||
function updateOnItemsChanged() {
|
||||
itemsDirty = true;
|
||||
if (isAutoUpdateOnChanged) {
|
||||
update()
|
||||
}
|
||||
}
|
||||
|
||||
property bool isAutoUpdateOnChanged: false
|
||||
function setAutoUpdateOnChanged(enabled) {
|
||||
isAutoUpdateOnChanged = enabled
|
||||
if (enabled) {
|
||||
update()
|
||||
}
|
||||
}
|
||||
|
||||
function forceUpdate() {
|
||||
update();
|
||||
}
|
||||
items.onChanged: updateOnItemsChanged()
|
||||
onLessThanChanged: update()
|
||||
onAcceptItemChanged: update()
|
||||
|
||||
|
|
|
@ -33,11 +33,11 @@ Item {
|
|||
|
||||
// PropItem is stretching horizontally accross its parent
|
||||
// Fixed height
|
||||
height: global.lineHeight
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
height: global.lineHeight
|
||||
anchors.leftMargin: global.horizontalMargin
|
||||
anchors.rightMargin: global.horizontalMargin
|
||||
// anchors.leftMargin: global.horizontalMargin
|
||||
// anchors.rightMargin: global.horizontalMargin
|
||||
|
||||
// LabelControl And SplitterControl are on the left side of the PropItem
|
||||
property bool showLabel: true
|
||||
|
|
Loading…
Reference in a new issue