mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-08 18:32:34 +02:00
Merge branch 'master' of github.com:highfidelity/hifi into model-scripting
This commit is contained in:
commit
9e8fcc0def
13 changed files with 96 additions and 29 deletions
4
cmake/externals/wasapi/CMakeLists.txt
vendored
4
cmake/externals/wasapi/CMakeLists.txt
vendored
|
@ -6,8 +6,8 @@ if (WIN32)
|
|||
include(ExternalProject)
|
||||
ExternalProject_Add(
|
||||
${EXTERNAL_NAME}
|
||||
URL http://hifi-public.s3.amazonaws.com/dependencies/qtaudio_wasapi6.zip
|
||||
URL_MD5 fcac808c1ba0b0f5b44ea06e2612ebab
|
||||
URL http://hifi-public.s3.amazonaws.com/dependencies/qtaudio_wasapi7.zip
|
||||
URL_MD5 bc2861e50852dd590cdc773a14a041a7
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
|
|
|
@ -33,6 +33,7 @@ Item {
|
|||
propagateComposedEvents: true
|
||||
acceptedButtons: "AllButtons"
|
||||
onClicked: {
|
||||
menu.visible = false;
|
||||
menu.done();
|
||||
mouse.accepted = false;
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ Item {
|
|||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
menu.visible = false;
|
||||
root.triggered();
|
||||
menu.done();
|
||||
}
|
||||
|
|
|
@ -1084,17 +1084,17 @@ int Octree::encodeTreeBitstreamRecursion(OctreeElementPointer element,
|
|||
params.stopReason = EncodeBitstreamParams::WAS_IN_VIEW;
|
||||
return bytesAtThisLevel;
|
||||
}
|
||||
}
|
||||
|
||||
// If we're not in delta sending mode, and we weren't asked to do a force send, and the voxel hasn't changed,
|
||||
// then we can also bail early and save bits
|
||||
if (!params.forceSendScene && !params.deltaView &&
|
||||
!element->hasChangedSince(params.lastQuerySent - CHANGE_FUDGE)) {
|
||||
if (params.stats) {
|
||||
params.stats->skippedNoChange(element);
|
||||
}
|
||||
params.stopReason = EncodeBitstreamParams::NO_CHANGE;
|
||||
return bytesAtThisLevel;
|
||||
// If we're not in delta sending mode, and we weren't asked to do a force send, and the octree element hasn't changed,
|
||||
// then we can also bail early and save bits
|
||||
if (!params.forceSendScene && !params.deltaView &&
|
||||
!element->hasChangedSince(params.lastQuerySent - CHANGE_FUDGE)) {
|
||||
if (params.stats) {
|
||||
params.stats->skippedNoChange(element);
|
||||
}
|
||||
params.stopReason = EncodeBitstreamParams::NO_CHANGE;
|
||||
return bytesAtThisLevel;
|
||||
}
|
||||
|
||||
bool keepDiggingDeeper = true; // Assuming we're in view we have a great work ethic, we're always ready for more!
|
||||
|
|
|
@ -92,6 +92,15 @@ bool LightingModel::isAlbedoEnabled() const {
|
|||
return (bool)_parametersBuffer.get<Parameters>().enableAlbedo;
|
||||
}
|
||||
|
||||
void LightingModel::setMaterialTexturing(bool enable) {
|
||||
if (enable != isMaterialTexturingEnabled()) {
|
||||
_parametersBuffer.edit<Parameters>().enableMaterialTexturing = (float)enable;
|
||||
}
|
||||
}
|
||||
bool LightingModel::isMaterialTexturingEnabled() const {
|
||||
return (bool)_parametersBuffer.get<Parameters>().enableMaterialTexturing;
|
||||
}
|
||||
|
||||
void LightingModel::setAmbientLight(bool enable) {
|
||||
if (enable != isAmbientLightEnabled()) {
|
||||
_parametersBuffer.edit<Parameters>().enableAmbientLight = (float)enable;
|
||||
|
@ -150,6 +159,8 @@ void MakeLightingModel::configure(const Config& config) {
|
|||
_lightingModel->setSpecular(config.enableSpecular);
|
||||
_lightingModel->setAlbedo(config.enableAlbedo);
|
||||
|
||||
_lightingModel->setMaterialTexturing(config.enableMaterialTexturing);
|
||||
|
||||
_lightingModel->setAmbientLight(config.enableAmbientLight);
|
||||
_lightingModel->setDirectionalLight(config.enableDirectionalLight);
|
||||
_lightingModel->setPointLight(config.enablePointLight);
|
||||
|
@ -160,5 +171,8 @@ void MakeLightingModel::configure(const Config& config) {
|
|||
|
||||
void MakeLightingModel::run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, LightingModelPointer& lightingModel) {
|
||||
|
||||
lightingModel = _lightingModel;
|
||||
lightingModel = _lightingModel;
|
||||
|
||||
// make sure the enableTexturing flag of the render ARgs is in sync
|
||||
renderContext->args->_enableTexturing = _lightingModel->isMaterialTexturingEnabled();
|
||||
}
|
|
@ -49,6 +49,8 @@ public:
|
|||
void setAlbedo(bool enable);
|
||||
bool isAlbedoEnabled() const;
|
||||
|
||||
void setMaterialTexturing(bool enable);
|
||||
bool isMaterialTexturingEnabled() const;
|
||||
|
||||
void setAmbientLight(bool enable);
|
||||
bool isAmbientLightEnabled() const;
|
||||
|
@ -88,9 +90,12 @@ protected:
|
|||
float enableSpotLight{ 1.0f };
|
||||
|
||||
float showLightContour{ 0.0f }; // false by default
|
||||
|
||||
float enableObscurance{ 1.0f };
|
||||
|
||||
glm::vec2 spares{ 0.0f };
|
||||
float enableMaterialTexturing { 1.0f };
|
||||
|
||||
float spares{ 0.0f };
|
||||
|
||||
Parameters() {}
|
||||
};
|
||||
|
@ -117,6 +122,8 @@ class MakeLightingModelConfig : public render::Job::Config {
|
|||
Q_PROPERTY(bool enableSpecular MEMBER enableSpecular NOTIFY dirty)
|
||||
Q_PROPERTY(bool enableAlbedo MEMBER enableAlbedo NOTIFY dirty)
|
||||
|
||||
Q_PROPERTY(bool enableMaterialTexturing MEMBER enableMaterialTexturing NOTIFY dirty)
|
||||
|
||||
Q_PROPERTY(bool enableAmbientLight MEMBER enableAmbientLight NOTIFY dirty)
|
||||
Q_PROPERTY(bool enableDirectionalLight MEMBER enableDirectionalLight NOTIFY dirty)
|
||||
Q_PROPERTY(bool enablePointLight MEMBER enablePointLight NOTIFY dirty)
|
||||
|
@ -136,13 +143,16 @@ public:
|
|||
bool enableScattering{ true };
|
||||
bool enableDiffuse{ true };
|
||||
bool enableSpecular{ true };
|
||||
|
||||
bool enableAlbedo{ true };
|
||||
bool enableMaterialTexturing { true };
|
||||
|
||||
bool enableAmbientLight{ true };
|
||||
bool enableDirectionalLight{ true };
|
||||
bool enablePointLight{ true };
|
||||
bool enableSpotLight{ true };
|
||||
|
||||
|
||||
bool showLightContour { false }; // false by default
|
||||
|
||||
signals:
|
||||
|
|
|
@ -129,7 +129,7 @@ void MeshPartPayload::bindMesh(gpu::Batch& batch) const {
|
|||
}
|
||||
}
|
||||
|
||||
void MeshPartPayload::bindMaterial(gpu::Batch& batch, const ShapePipeline::LocationsPointer locations) const {
|
||||
void MeshPartPayload::bindMaterial(gpu::Batch& batch, const ShapePipeline::LocationsPointer locations, bool enableTextures) const {
|
||||
if (!_drawMaterial) {
|
||||
return;
|
||||
}
|
||||
|
@ -147,6 +147,17 @@ void MeshPartPayload::bindMaterial(gpu::Batch& batch, const ShapePipeline::Locat
|
|||
numUnlit++;
|
||||
}
|
||||
|
||||
if (!enableTextures) {
|
||||
batch.setResourceTexture(ShapePipeline::Slot::ALBEDO, textureCache->getWhiteTexture());
|
||||
batch.setResourceTexture(ShapePipeline::Slot::MAP::ROUGHNESS, textureCache->getWhiteTexture());
|
||||
batch.setResourceTexture(ShapePipeline::Slot::MAP::NORMAL, nullptr);
|
||||
batch.setResourceTexture(ShapePipeline::Slot::MAP::METALLIC, nullptr);
|
||||
batch.setResourceTexture(ShapePipeline::Slot::MAP::OCCLUSION, nullptr);
|
||||
batch.setResourceTexture(ShapePipeline::Slot::MAP::SCATTERING, nullptr);
|
||||
batch.setResourceTexture(ShapePipeline::Slot::MAP::EMISSIVE_LIGHTMAP, nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
// Albedo
|
||||
if (materialKey.isAlbedoMap()) {
|
||||
auto itr = textureMaps.find(model::MaterialKey::ALBEDO_MAP);
|
||||
|
@ -271,7 +282,7 @@ void MeshPartPayload::render(RenderArgs* args) const {
|
|||
bindMesh(batch);
|
||||
|
||||
// apply material properties
|
||||
bindMaterial(batch, locations);
|
||||
bindMaterial(batch, locations, args->_enableTexturing);
|
||||
|
||||
if (args) {
|
||||
args->_details._materialSwitches++;
|
||||
|
@ -363,12 +374,7 @@ void ModelMeshPartPayload::updateTransformForSkinnedMesh(const Transform& transf
|
|||
_transform = transform;
|
||||
|
||||
if (clusterMatrices.size() > 0) {
|
||||
_worldBound = AABox();
|
||||
for (auto& clusterMatrix : clusterMatrices) {
|
||||
AABox clusterBound = _localBound;
|
||||
clusterBound.transform(clusterMatrix);
|
||||
_worldBound += clusterBound;
|
||||
}
|
||||
_worldBound = _adjustedLocalBound;
|
||||
_worldBound.transform(_transform);
|
||||
if (clusterMatrices.size() == 1) {
|
||||
_transform = _transform.worldTransform(Transform(clusterMatrices[0]));
|
||||
|
@ -588,7 +594,7 @@ void ModelMeshPartPayload::render(RenderArgs* args) const {
|
|||
bindMesh(batch);
|
||||
|
||||
// apply material properties
|
||||
bindMaterial(batch, locations);
|
||||
bindMaterial(batch, locations, args->_enableTexturing);
|
||||
|
||||
args->_details._materialSwitches++;
|
||||
|
||||
|
@ -601,3 +607,15 @@ void ModelMeshPartPayload::render(RenderArgs* args) const {
|
|||
const int INDICES_PER_TRIANGLE = 3;
|
||||
args->_details._trianglesRendered += _drawPart._numIndices / INDICES_PER_TRIANGLE;
|
||||
}
|
||||
|
||||
void ModelMeshPartPayload::computeAdjustedLocalBound(const QVector<glm::mat4>& clusterMatrices) {
|
||||
_adjustedLocalBound = _localBound;
|
||||
if (clusterMatrices.size() > 0) {
|
||||
_adjustedLocalBound.transform(clusterMatrices[0]);
|
||||
for (int i = 1; i < clusterMatrices.size(); ++i) {
|
||||
AABox clusterBound = _localBound;
|
||||
clusterBound.transform(clusterMatrices[i]);
|
||||
_adjustedLocalBound += clusterBound;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// ModelMeshPartPayload.h
|
||||
// MeshPartPayload.h
|
||||
// interface/src/renderer
|
||||
//
|
||||
// Created by Sam Gateau on 10/3/15.
|
||||
|
@ -51,7 +51,7 @@ public:
|
|||
// ModelMeshPartPayload functions to perform render
|
||||
void drawCall(gpu::Batch& batch) const;
|
||||
virtual void bindMesh(gpu::Batch& batch) const;
|
||||
virtual void bindMaterial(gpu::Batch& batch, const render::ShapePipeline::LocationsPointer locations) const;
|
||||
virtual void bindMaterial(gpu::Batch& batch, const render::ShapePipeline::LocationsPointer locations, bool enableTextures) const;
|
||||
virtual void bindTransform(gpu::Batch& batch, const render::ShapePipeline::LocationsPointer locations, RenderArgs::RenderMode renderMode) const;
|
||||
|
||||
// Payload resource cached values
|
||||
|
@ -61,6 +61,7 @@ public:
|
|||
bool _hasColorAttrib { false };
|
||||
|
||||
model::Box _localBound;
|
||||
model::Box _adjustedLocalBound;
|
||||
mutable model::Box _worldBound;
|
||||
std::shared_ptr<const model::Mesh> _drawMesh;
|
||||
|
||||
|
@ -105,6 +106,8 @@ public:
|
|||
|
||||
void initCache();
|
||||
|
||||
void computeAdjustedLocalBound(const QVector<glm::mat4>& clusterMatrices);
|
||||
|
||||
Model* _model;
|
||||
|
||||
int _meshIndex;
|
||||
|
|
|
@ -1149,6 +1149,8 @@ void Model::simulate(float deltaTime, bool fullUpdate) {
|
|||
// update the world space transforms for all joints
|
||||
glm::mat4 parentTransform = glm::scale(_scale) * glm::translate(_offset);
|
||||
updateRig(deltaTime, parentTransform);
|
||||
|
||||
computeMeshPartLocalBounds();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1158,6 +1160,14 @@ void Model::updateRig(float deltaTime, glm::mat4 parentTransform) {
|
|||
_rig->updateAnimations(deltaTime, parentTransform);
|
||||
}
|
||||
|
||||
void Model::computeMeshPartLocalBounds() {
|
||||
for (auto& part : _modelMeshRenderItemsSet) {
|
||||
assert(part->_meshIndex < _modelMeshRenderItemsSet.size());
|
||||
const Model::MeshState& state = _meshStates.at(part->_meshIndex);
|
||||
part->computeAdjustedLocalBound(state.clusterMatrices);
|
||||
}
|
||||
}
|
||||
|
||||
// virtual
|
||||
void Model::updateClusterMatrices() {
|
||||
PerformanceTimer perfTimer("Model::updateClusterMatrices");
|
||||
|
@ -1334,6 +1344,7 @@ void Model::createVisibleRenderItemSet() {
|
|||
shapeID++;
|
||||
}
|
||||
}
|
||||
computeMeshPartLocalBounds();
|
||||
}
|
||||
|
||||
void Model::createCollisionRenderItemSet() {
|
||||
|
|
|
@ -244,7 +244,6 @@ public:
|
|||
public:
|
||||
QVector<glm::mat4> clusterMatrices;
|
||||
gpu::BufferPointer clusterBuffer;
|
||||
|
||||
};
|
||||
|
||||
const MeshState& getMeshState(int index) { return _meshStates.at(index); }
|
||||
|
@ -319,6 +318,7 @@ protected:
|
|||
void scaleToFit();
|
||||
void snapToRegistrationPoint();
|
||||
|
||||
void computeMeshPartLocalBounds();
|
||||
virtual void updateRig(float deltaTime, glm::mat4 parentTransform);
|
||||
|
||||
/// Restores the indexed joint to its default position.
|
||||
|
|
|
@ -134,7 +134,7 @@ static inline bool cpuSupportsAVX() {
|
|||
result = true;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
static inline bool cpuSupportsAVX2() {
|
||||
|
@ -143,11 +143,18 @@ static inline bool cpuSupportsAVX2() {
|
|||
bool result = false;
|
||||
if (cpuSupportsAVX()) {
|
||||
|
||||
if (__get_cpuid(0x7, &eax, &ebx, &ecx, &edx) && ((ebx & MASK_AVX2) == MASK_AVX2)) {
|
||||
result = true;
|
||||
// Work around a bug where __get_cpuid(0x7) returns wrong values on older GCC
|
||||
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77756
|
||||
if (__get_cpuid(0x0, &eax, &ebx, &ecx, &edx) && (eax >= 0x7)) {
|
||||
|
||||
__cpuid_count(0x7, 0x0, eax, ebx, ecx, edx);
|
||||
|
||||
if ((ebx & MASK_AVX2) == MASK_AVX2) {
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
#else
|
||||
|
|
|
@ -122,6 +122,7 @@ public:
|
|||
gpu::Batch* _batch = nullptr;
|
||||
|
||||
std::shared_ptr<gpu::Texture> _whiteTexture;
|
||||
bool _enableTexturing { true };
|
||||
|
||||
RenderDetails _details;
|
||||
};
|
||||
|
|
|
@ -25,6 +25,7 @@ Column {
|
|||
"Lightmap:LightingModel:enableLightmap",
|
||||
"Background:LightingModel:enableBackground",
|
||||
"ssao:AmbientOcclusion:enabled",
|
||||
"Textures:LightingModel:enableMaterialTexturing",
|
||||
]
|
||||
CheckBox {
|
||||
text: modelData.split(":")[0]
|
||||
|
|
Loading…
Reference in a new issue