Merging with upstream

This commit is contained in:
samcake 2015-10-20 10:13:47 -07:00
commit 07aac6b2c7
20 changed files with 260 additions and 237 deletions

View file

@ -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;

View file

@ -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;
};

View file

@ -154,7 +154,7 @@ controller::InputController::Pointer ControllerScriptingInterface::createInputCo
if (trackerID >= 0) {
controller::InputController::Pointer inputController = std::make_shared<InputController>(deviceID, trackerID, this);
controller::InputController::Key key = inputController->getKey();
_inputControllers.insert(InputControllerMap::value_type(inputController->getKey(), inputController));
_inputControllers.insert(InputControllerMap::value_type(key, inputController));
return inputController;
}
}

View file

@ -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);
}
}

View file

@ -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();

View file

@ -72,7 +72,7 @@ DeadZoneFilter::FactoryEntryBuilder DeadZoneFilter::_factoryEntryBuilder;
float DeadZoneFilter::apply(float value) const {
float scale = 1.0f / (1.0f - _min);
if (abs(value) < _min) {
if (std::abs(value) < _min) {
return 0.0f;
}
return (value - _min) * scale;
@ -89,9 +89,9 @@ PulseFilter::FactoryEntryBuilder PulseFilter::_factoryEntryBuilder;
float PulseFilter::apply(float value) const {
float result = 0.0;
float result = 0.0f;
if (0.0 != value) {
if (0.0f != value) {
float now = secTimestampNow();
float delta = now - _lastEmitTime;
if (delta >= _interval) {

View file

@ -6,32 +6,5 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#pragma once
#ifndef hifi_Controllers_Route_h
#define hifi_Controllers_Route_h
#include "Endpoint.h"
#include "Filter.h"
#include "Logging.h"
class QJsonObject;
namespace controller {
/*
* encapsulates a source, destination and filters to apply
*/
class Route {
public:
Endpoint::Pointer _source;
Endpoint::Pointer _destination;
Filter::List _filters;
using Pointer = std::shared_ptr<Route>;
using List = std::list<Pointer>;
void parse(const QJsonObject& json);
};
}
#endif
#include "Route.h"

View file

@ -102,7 +102,7 @@ namespace controller {
: Endpoint(UserInputMapper::Input(UserInputMapper::Input::INVALID_INPUT)), Pair(first, second) { }
virtual float value() {
float result = first->value() * -1.0 + second->value();
float result = first->value() * -1.0f + second->value();
return result;
}
@ -408,8 +408,7 @@ namespace controller {
// Fetch the value, may have been overriden by previous loopback routes
if (source->isPose()) {
Pose value = getPoseValue(source);
// no filters yet for pose
destination->apply(value, Pose(), source);
} else {
float value = getValue(source);
@ -498,7 +497,7 @@ namespace controller {
}
bool ScriptingInterface::isButtonPressed(int buttonIndex) const {
return getButtonValue((StandardButtonChannel)buttonIndex) == 0.0 ? false : true;
return getButtonValue((StandardButtonChannel)buttonIndex) == 0.0f ? false : true;
}
int ScriptingInterface::getNumberOfTriggers() const {

View file

@ -15,8 +15,6 @@
#include "StandardController.h"
const float CONTROLLER_THRESHOLD = 0.3f;
StandardController::~StandardController() {
}

View file

@ -52,10 +52,9 @@ class RouteBuilderProxy : public QObject {
void to(const Endpoint::Pointer& destination);
void addFilter(Filter::Lambda lambda);
void addFilter(Filter::Pointer filter);
ScriptingInterface& _parent;
Mapping::Pointer _mapping;
Route::Pointer _route;
ScriptingInterface& _parent;
};
}

View file

@ -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

View file

@ -32,10 +32,6 @@
Q_DECLARE_LOGGING_CATEGORY(inputplugins)
Q_LOGGING_CATEGORY(inputplugins, "hifi.inputplugins")
// These bits aren't used for buttons, so they can be used as masks:
const unsigned int LEFT_MASK = 0;
const unsigned int RIGHT_MASK = 1U << 1;
#ifdef HAVE_SIXENSE
const int CALIBRATION_STATE_IDLE = 0;

View file

@ -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)) {

View file

@ -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 {

View file

@ -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 {

View file

@ -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())));

View file

@ -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);

View file

@ -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;

View file

@ -1,158 +1,158 @@
//
// main.cpp
// tests/gpu-test/src
//
// Copyright 2015 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include <unordered_map>
#include <memory>
#include <cstdio>
#include <mutex>
#include <set>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <QtCore/QTime>
#include <QtCore/QTimer>
#include <QtCore/QDir>
#include <QtCore/QElapsedTimer>
#include <QtCore/QFile>
#include <QtCore/QLoggingCategory>
#include <QtGui/QResizeEvent>
#include <QtGui/QWindow>
#include <QtGui/QGuiApplication>
#include <QtGui/QImage>
#include <QtQuick/QQuickItem>
//
// main.cpp
// tests/gpu-test/src
//
// Copyright 2015 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include <unordered_map>
#include <memory>
#include <cstdio>
#include <mutex>
#include <set>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <QtCore/QTime>
#include <QtCore/QTimer>
#include <QtCore/QDir>
#include <QtCore/QElapsedTimer>
#include <QtCore/QFile>
#include <QtCore/QLoggingCategory>
#include <QtGui/QResizeEvent>
#include <QtGui/QWindow>
#include <QtGui/QGuiApplication>
#include <QtGui/QImage>
#include <QtQuick/QQuickItem>
#include <QtQml/QQmlApplicationEngine>
#include <QtQml/QQmlContext>
#include <plugins/Plugin.h>
#include <plugins/PluginContainer.h>
#include <plugins/PluginManager.h>
#include <input-plugins/InputPlugin.h>
#include <input-plugins/KeyboardMouseDevice.h>
#include <controllers/ScriptingInterface.h>
#include <DependencyManager.h>
#include <controllers/UserInputMapper.h>
const QString& getResourcesDir() {
static QString dir;
if (dir.isEmpty()) {
QDir path(__FILE__);
path.cdUp();
dir = path.cleanPath(path.absoluteFilePath("../../../interface/resources/")) + "/";
qDebug() << "Resources Path: " << dir;
}
return dir;
}
const QString& getQmlDir() {
static QString dir;
if (dir.isEmpty()) {
dir = getResourcesDir() + "qml/";
qDebug() << "Qml Path: " << dir;
}
return dir;
}
const QString& getTestQmlDir() {
static QString dir;
if (dir.isEmpty()) {
QDir path(__FILE__);
path.cdUp();
dir = path.cleanPath(path.absoluteFilePath("../")) + "/qml/";
qDebug() << "Qml Test Path: " << dir;
}
return dir;
}
using namespace controller;
class PluginContainerProxy : public QObject, PluginContainer {
Q_OBJECT
public:
PluginContainerProxy() {
Plugin::setContainer(this);
}
virtual ~PluginContainerProxy() {}
virtual void addMenu(const QString& menuName) override {}
virtual void removeMenu(const QString& menuName) override {}
virtual QAction* addMenuItem(const QString& path, const QString& name, std::function<void(bool)> onClicked, bool checkable = false, bool checked = false, const QString& groupName = "") override { return nullptr; }
virtual void removeMenuItem(const QString& menuName, const QString& menuItem) override {}
virtual bool isOptionChecked(const QString& name) override { return false; }
virtual void setIsOptionChecked(const QString& path, bool checked) override {}
virtual void setFullscreen(const QScreen* targetScreen, bool hideMenu = true) override {}
virtual void unsetFullscreen(const QScreen* avoidScreen = nullptr) override {}
virtual void showDisplayPluginsTools() override {}
virtual void requestReset() override {}
virtual QGLWidget* getPrimarySurface() override { return nullptr; }
virtual bool isForeground() override { return true; }
virtual const DisplayPlugin* getActiveDisplayPlugin() const override { return nullptr; }
};
class MyControllerScriptingInterface : public controller::ScriptingInterface {
public:
virtual void registerControllerTypes(QScriptEngine* engine) {};
};
int main(int argc, char** argv) {
QGuiApplication app(argc, argv);
#include <plugins/Plugin.h>
#include <plugins/PluginContainer.h>
#include <plugins/PluginManager.h>
#include <input-plugins/InputPlugin.h>
#include <input-plugins/KeyboardMouseDevice.h>
#include <controllers/ScriptingInterface.h>
#include <DependencyManager.h>
#include <controllers/UserInputMapper.h>
const QString& getResourcesDir() {
static QString dir;
if (dir.isEmpty()) {
QDir path(__FILE__);
path.cdUp();
dir = path.cleanPath(path.absoluteFilePath("../../../interface/resources/")) + "/";
qDebug() << "Resources Path: " << dir;
}
return dir;
}
const QString& getQmlDir() {
static QString dir;
if (dir.isEmpty()) {
dir = getResourcesDir() + "qml/";
qDebug() << "Qml Path: " << dir;
}
return dir;
}
const QString& getTestQmlDir() {
static QString dir;
if (dir.isEmpty()) {
QDir path(__FILE__);
path.cdUp();
dir = path.cleanPath(path.absoluteFilePath("../")) + "/qml/";
qDebug() << "Qml Test Path: " << dir;
}
return dir;
}
using namespace controller;
class PluginContainerProxy : public QObject, PluginContainer {
Q_OBJECT
public:
PluginContainerProxy() {
Plugin::setContainer(this);
}
virtual ~PluginContainerProxy() {}
virtual void addMenu(const QString& menuName) override {}
virtual void removeMenu(const QString& menuName) override {}
virtual QAction* addMenuItem(const QString& path, const QString& name, std::function<void(bool)> onClicked, bool checkable = false, bool checked = false, const QString& groupName = "") override { return nullptr; }
virtual void removeMenuItem(const QString& menuName, const QString& menuItem) override {}
virtual bool isOptionChecked(const QString& name) override { return false; }
virtual void setIsOptionChecked(const QString& path, bool checked) override {}
virtual void setFullscreen(const QScreen* targetScreen, bool hideMenu = true) override {}
virtual void unsetFullscreen(const QScreen* avoidScreen = nullptr) override {}
virtual void showDisplayPluginsTools() override {}
virtual void requestReset() override {}
virtual QGLWidget* getPrimarySurface() override { return nullptr; }
virtual bool isForeground() override { return true; }
virtual const DisplayPlugin* getActiveDisplayPlugin() const override { return nullptr; }
};
class MyControllerScriptingInterface : public controller::ScriptingInterface {
public:
virtual void registerControllerTypes(QScriptEngine* engine) {};
};
int main(int argc, char** argv) {
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
auto rootContext = engine.rootContext();
new PluginContainerProxy();
// Simulate our application idle loop
QTimer timer;
QObject::connect(&timer, &QTimer::timeout, [] {
static float last = secTimestampNow();
float now = secTimestampNow();
float delta = now - last;
last = now;
foreach(auto inputPlugin, PluginManager::getInstance()->getInputPlugins()) {
inputPlugin->pluginUpdate(delta, false);
}
auto userInputMapper = DependencyManager::get<UserInputMapper>();
userInputMapper->update(delta);
});
timer.start(50);
{
DependencyManager::set<UserInputMapper>();
foreach(auto inputPlugin, PluginManager::getInstance()->getInputPlugins()) {
QString name = inputPlugin->getName();
inputPlugin->activate();
auto userInputMapper = DependencyManager::get<UserInputMapper>();
if (name == KeyboardMouseDevice::NAME) {
auto keyboardMouseDevice = static_cast<KeyboardMouseDevice*>(inputPlugin.data()); // TODO: this seems super hacky
keyboardMouseDevice->registerToUserInputMapper(*userInputMapper);
}
inputPlugin->pluginUpdate(0, false);
}
// Simulate our application idle loop
QTimer timer;
QObject::connect(&timer, &QTimer::timeout, [] {
static float last = secTimestampNow();
float now = secTimestampNow();
float delta = now - last;
last = now;
foreach(auto inputPlugin, PluginManager::getInstance()->getInputPlugins()) {
inputPlugin->pluginUpdate(delta, false);
}
auto userInputMapper = DependencyManager::get<UserInputMapper>();
userInputMapper->update(delta);
});
timer.start(50);
{
DependencyManager::set<UserInputMapper>();
foreach(auto inputPlugin, PluginManager::getInstance()->getInputPlugins()) {
QString name = inputPlugin->getName();
inputPlugin->activate();
auto userInputMapper = DependencyManager::get<UserInputMapper>();
if (name == KeyboardMouseDevice::NAME) {
auto keyboardMouseDevice = static_cast<KeyboardMouseDevice*>(inputPlugin.data()); // TODO: this seems super hacky
keyboardMouseDevice->registerToUserInputMapper(*userInputMapper);
}
inputPlugin->pluginUpdate(0, false);
}
rootContext->setContextProperty("Controllers", new MyControllerScriptingInterface());
}
qDebug() << getQmlDir();
}
qDebug() << getQmlDir();
rootContext->setContextProperty("ResourcePath", getQmlDir());
engine.setBaseUrl(QUrl::fromLocalFile(getQmlDir()));
engine.addImportPath(getQmlDir());
engine.load(getTestQmlDir() + "main.qml");
for (auto pathItem : engine.importPathList()) {
qDebug() << pathItem;
}
app.exec();
return 0;
}
#include "main.moc"
engine.setBaseUrl(QUrl::fromLocalFile(getQmlDir()));
engine.addImportPath(getQmlDir());
engine.load(getTestQmlDir() + "main.qml");
for (auto pathItem : engine.importPathList()) {
qDebug() << pathItem;
}
app.exec();
return 0;
}
#include "main.moc"

View file

@ -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;