mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 03:40:20 +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 "RenderPipelines.h"
|
||||||
#include "GeometryCache.h"
|
#include "GeometryCache.h"
|
||||||
|
|
||||||
|
#include "EntitiesRendererLogging.h"
|
||||||
|
|
||||||
|
|
||||||
using namespace render;
|
using namespace render;
|
||||||
using namespace render::entities;
|
using namespace render::entities;
|
||||||
|
|
||||||
|
@ -195,7 +198,10 @@ void MaterialEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPo
|
||||||
auto material = getMaterial();
|
auto material = getMaterial();
|
||||||
bool newTexturesLoaded = material ? !material->isMissingTexture() : false;
|
bool newTexturesLoaded = material ? !material->isMissingTexture() : false;
|
||||||
if (!_texturesLoaded && newTexturesLoaded) {
|
if (!_texturesLoaded && newTexturesLoaded) {
|
||||||
material->checkResetOpacityMap();
|
bool changed = material->checkResetOpacityMap();
|
||||||
|
if (changed) {
|
||||||
|
qCWarning(entitiesrenderer) << "opacity change detected for material " << material->getName().c_str();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_texturesLoaded = newTexturesLoaded;
|
_texturesLoaded = newTexturesLoaded;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
|
|
||||||
#include <Transform.h>
|
#include <Transform.h>
|
||||||
|
|
||||||
|
#include "GraphicsLogging.h"
|
||||||
|
|
||||||
using namespace graphics;
|
using namespace graphics;
|
||||||
using namespace gpu;
|
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
|
// Clear the previous flags
|
||||||
_key.setOpacityMaskMap(false);
|
_key.setOpacityMaskMap(false);
|
||||||
_key.setTranslucentMap(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 {
|
const TextureMapPointer Material::getTextureMap(MapChannel channel) const {
|
||||||
|
|
|
@ -358,7 +358,8 @@ public:
|
||||||
|
|
||||||
// Albedo maps cannot have opacity detected until they are loaded
|
// Albedo maps cannot have opacity detected until they are loaded
|
||||||
// This method allows const changing of the key/schemaBuffer without touching the map
|
// 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
|
// conversion from legacy material properties to PBR equivalent
|
||||||
static float shininessToRoughness(float shininess) { return 1.0f - shininess / 100.0f; }
|
static float shininessToRoughness(float shininess) { return 1.0f - shininess / 100.0f; }
|
||||||
|
|
|
@ -748,13 +748,14 @@ bool NetworkMaterial::isMissingTexture() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkMaterial::checkResetOpacityMap() {
|
bool NetworkMaterial::checkResetOpacityMap() {
|
||||||
// If material textures are loaded, check the material translucency
|
// 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.
|
// 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.
|
// 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
|
// 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];
|
const auto& albedoTexture = _textures[NetworkMaterial::MapChannel::ALBEDO_MAP];
|
||||||
if (albedoTexture.texture) {
|
if (albedoTexture.texture) {
|
||||||
resetOpacityMap();
|
return resetOpacityMap();
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ public:
|
||||||
void setLightMap(const QUrl& url);
|
void setLightMap(const QUrl& url);
|
||||||
|
|
||||||
bool isMissingTexture();
|
bool isMissingTexture();
|
||||||
void checkResetOpacityMap();
|
bool checkResetOpacityMap();
|
||||||
|
|
||||||
class Texture {
|
class Texture {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -472,7 +472,10 @@ bool Geometry::areTexturesLoaded() const {
|
||||||
return false;
|
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) {
|
for (auto& materialMapping : _materialMapping) {
|
||||||
|
@ -483,7 +486,10 @@ bool Geometry::areTexturesLoaded() const {
|
||||||
return false;
|
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
|
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
|
interval: 2000; running: true; repeat: true
|
||||||
onTriggered: pullFreshValues()
|
onTriggered: pullFreshValues()
|
||||||
}*/
|
}
|
||||||
|
|
||||||
function pullFreshValues() {
|
function pullFreshValues() {
|
||||||
if (needFreshList) {
|
if (needFreshList) {
|
||||||
//console.log("Updating " + cacheResourceName + "cache list")
|
|
||||||
updateItemList(fetchItemsList())
|
updateItemList(fetchItemsList())
|
||||||
needFreshList = false
|
needFreshList = false
|
||||||
}
|
}
|
||||||
|
@ -127,7 +126,9 @@ Item {
|
||||||
var item = itemList[i]
|
var item = itemList[i]
|
||||||
currentItemsList.push(item)
|
currentItemsList.push(item)
|
||||||
resourceItemsModel.append(packItemEntry(item, currentItemsList.length -1))
|
resourceItemsModel.append(packItemEntry(item, currentItemsList.length -1))
|
||||||
}
|
}
|
||||||
|
// At the end of it, force an update
|
||||||
|
visualModel.forceUpdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateItemList(newItemList) {
|
function updateItemList(newItemList) {
|
||||||
|
@ -148,6 +149,7 @@ Item {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
height: totalCount.height
|
height: totalCount.height
|
||||||
|
id: headerTop
|
||||||
|
|
||||||
Prop.PropButton {
|
Prop.PropButton {
|
||||||
id: refreshButton
|
id: refreshButton
|
||||||
|
@ -158,30 +160,46 @@ Item {
|
||||||
onPressed: { pullFreshValues() }
|
onPressed: { pullFreshValues() }
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
GridLayout {
|
||||||
anchors.left: refreshButton.right
|
anchors.left: refreshButton.right
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
Prop.PropScalar {
|
id: headerCountLane
|
||||||
id: totalCount
|
columns: 3
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.horizontalCenter
|
Item {
|
||||||
label: "Count"
|
Layout.fillWidth: true
|
||||||
object: root.cache
|
Prop.PropScalar {
|
||||||
property: "numTotal"
|
id: itemCount
|
||||||
integral: true
|
label: "Count"
|
||||||
readOnly: true
|
object: root.cache
|
||||||
onSourceValueVarChanged: { updateItemListFromCache() }
|
property: "numTotal"
|
||||||
|
integral: true
|
||||||
|
readOnly: true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Prop.PropScalar {
|
Item {
|
||||||
id: cachedCount
|
Layout.fillWidth: true
|
||||||
anchors.left: parent.horizontalCenter
|
Prop.PropScalar {
|
||||||
anchors.right: parent.right
|
id: totalCount
|
||||||
label: "Cached"
|
label: "Count"
|
||||||
object: root.cache
|
object: root.cache
|
||||||
property: "numCached"
|
property: "numTotal"
|
||||||
integral: true
|
integral: true
|
||||||
readOnly: true
|
readOnly: true
|
||||||
onSourceValueVarChanged: { updateItemListFromCache() }
|
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)
|
//console.log("refreshFilter! token = " + textFilter + " field = " + filterField)
|
||||||
acceptItem = acceptItemArray[(textFilter.length != 0) * + (1 + filterField)]
|
acceptItem = acceptItemArray[(textFilter.length != 0) * + (1 + filterField)]
|
||||||
}
|
}
|
||||||
|
|
||||||
delegate: resouceItemDelegate
|
delegate: resouceItemDelegate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,96 +6,71 @@ DelegateModel {
|
||||||
|
|
||||||
property var lessThan: function(left, right) { return true; }
|
property var lessThan: function(left, right) { return true; }
|
||||||
property var acceptItem: function(item) { 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) {
|
function insertPosition(lessThanFunctor, item) {
|
||||||
while (unsortedItems.count > 0) {
|
var lower = 0
|
||||||
var item = unsortedItems.get(0)
|
var upper = visibleItems.count
|
||||||
|
while (lower < upper) {
|
||||||
var index = insertPosition(lessThan, item)
|
var middle = Math.floor(lower + (upper - lower) / 2)
|
||||||
|
var result = lessThanFunctor(item.model, visibleItems.get(middle).model);
|
||||||
item.groups = "items"
|
if (result) {
|
||||||
items.move(item.itemsIndex, index)
|
upper = middle
|
||||||
|
} else {
|
||||||
|
lower = middle + 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
return lower
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
function sort(lessThanFunctor, acceptItemFunctor) {
|
function sortAndFilter(lessThanFunctor, acceptItemFunctor) {
|
||||||
while (unsortedItems.count > 0) {
|
while (unsortedItems.count > 0) {
|
||||||
var item = unsortedItems.get(0)
|
var item = unsortedItems.get(0)
|
||||||
|
|
||||||
if (acceptItemFunctor(item.model)) {
|
if (acceptItemFunctor(item.model)) {
|
||||||
var index = insertPosition(lessThanFunctor, item)
|
var index = insertPosition(lessThanFunctor, item)
|
||||||
|
|
||||||
item.groups = ["items","visible"]
|
item.groups = ["items","visible"]
|
||||||
visibleItems.move(item.visibleIndex, index)
|
visibleItems.move(item.visibleIndex, index)
|
||||||
} else {
|
} else {
|
||||||
item.groups = ["items"]
|
item.groups = ["items"]
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Private bool to track when items changed and view is dirty
|
||||||
|
property bool itemsDirty: true
|
||||||
function update() {
|
function update() {
|
||||||
|
console.log("SortFilterMode: update and sort and filter items !!" + items.count);
|
||||||
if (items.count > 0) {
|
if (items.count > 0) {
|
||||||
items.setGroups(0, items.count, ["items","unsorted"]);
|
items.setGroups(0, items.count, ["items","unsorted"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
sort(lessThan, acceptItem)
|
sortAndFilter(lessThan, acceptItem)
|
||||||
/*
|
itemsDirty = false;
|
||||||
// Step 1: Filter items
|
itemsUpdated()
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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()
|
onLessThanChanged: update()
|
||||||
onAcceptItemChanged: update()
|
onAcceptItemChanged: update()
|
||||||
|
|
||||||
|
|
|
@ -33,11 +33,11 @@ Item {
|
||||||
|
|
||||||
// PropItem is stretching horizontally accross its parent
|
// PropItem is stretching horizontally accross its parent
|
||||||
// Fixed height
|
// Fixed height
|
||||||
|
height: global.lineHeight
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
height: global.lineHeight
|
// anchors.leftMargin: global.horizontalMargin
|
||||||
anchors.leftMargin: global.horizontalMargin
|
// anchors.rightMargin: global.horizontalMargin
|
||||||
anchors.rightMargin: global.horizontalMargin
|
|
||||||
|
|
||||||
// LabelControl And SplitterControl are on the left side of the PropItem
|
// LabelControl And SplitterControl are on the left side of the PropItem
|
||||||
property bool showLabel: true
|
property bool showLabel: true
|
||||||
|
|
Loading…
Reference in a new issue