3
0
Fork 0
mirror of https://github.com/JulianGro/overte.git synced 2025-05-01 01:43:39 +02:00

Merge branch 'master' of github.com:highfidelity/hifi into commandLineParametersForAutotester

This commit is contained in:
NissimHadar 2018-05-03 08:25:19 -07:00
commit 8b3c451f91
64 changed files with 445 additions and 47 deletions
interface/src
libraries

View file

@ -7884,6 +7884,26 @@ void Application::switchDisplayMode() {
_previousHMDWornStatus = currentHMDWornStatus;
}
void Application::setShowBulletWireframe(bool value) {
_physicsEngine->setShowBulletWireframe(value);
}
void Application::setShowBulletAABBs(bool value) {
_physicsEngine->setShowBulletAABBs(value);
}
void Application::setShowBulletContactPoints(bool value) {
_physicsEngine->setShowBulletContactPoints(value);
}
void Application::setShowBulletConstraints(bool value) {
_physicsEngine->setShowBulletConstraints(value);
}
void Application::setShowBulletConstraintLimits(bool value) {
_physicsEngine->setShowBulletConstraintLimits(value);
}
void Application::startHMDStandBySession() {
_autoSwitchDisplayModeSupportedHMDPlugin->startStandBySession();
}

View file

@ -243,6 +243,7 @@ public:
bool isAboutToQuit() const { return _aboutToQuit; }
bool isPhysicsEnabled() const { return _physicsEnabled; }
PhysicsEnginePointer getPhysicsEngine() { return _physicsEngine; }
// the isHMDMode is true whenever we use the interface from an HMD and not a standard flat display
// rendering of several elements depend on that
@ -463,6 +464,12 @@ private slots:
void handleSandboxStatus(QNetworkReply* reply);
void switchDisplayMode();
void setShowBulletWireframe(bool value);
void setShowBulletAABBs(bool value);
void setShowBulletContactPoints(bool value);
void setShowBulletConstraints(bool value);
void setShowBulletConstraintLimits(bool value);
private:
void init();
bool handleKeyEventForFocusedEntityOrOverlay(QEvent* event);

View file

@ -18,6 +18,10 @@
/**jsdoc
* This API helps manage adding and deleting avatar bookmarks.
* @namespace AvatarBookmarks
*
* @hifi-interface
* @hifi-client-entity
*
*/
class AvatarBookmarks: public Bookmarks, public Dependency {

View file

@ -37,6 +37,10 @@ class AABox;
/**jsdoc
* The LOD class manages your Level of Detail functions within Interface.
* @namespace LODManager
*
* @hifi-interface
* @hifi-client-entity
*
* @property {number} presentTime <em>Read-only.</em>
* @property {number} engineRunTime <em>Read-only.</em>
* @property {number} gpuTime <em>Read-only.</em>

View file

@ -735,6 +735,12 @@ Menu::Menu() {
}
addCheckableActionToQMenuAndActionHash(physicsOptionsMenu, MenuOption::PhysicsShowHulls, 0, false, qApp->getEntities().data(), SIGNAL(setRenderDebugHulls()));
addCheckableActionToQMenuAndActionHash(physicsOptionsMenu, MenuOption::PhysicsShowBulletWireframe, 0, false, qApp, SLOT(setShowBulletWireframe(bool)));
addCheckableActionToQMenuAndActionHash(physicsOptionsMenu, MenuOption::PhysicsShowBulletAABBs, 0, false, qApp, SLOT(setShowBulletAABBs(bool)));
addCheckableActionToQMenuAndActionHash(physicsOptionsMenu, MenuOption::PhysicsShowBulletContactPoints, 0, false, qApp, SLOT(setShowBulletContactPoints(bool)));
addCheckableActionToQMenuAndActionHash(physicsOptionsMenu, MenuOption::PhysicsShowBulletConstraints, 0, false, qApp, SLOT(setShowBulletConstraints(bool)));
addCheckableActionToQMenuAndActionHash(physicsOptionsMenu, MenuOption::PhysicsShowBulletConstraintLimits, 0, false, qApp, SLOT(setShowBulletConstraintLimits(bool)));
// Developer > Ask to Reset Settings
addCheckableActionToQMenuAndActionHash(developerMenu, MenuOption::AskToResetSettings, 0, false);

View file

@ -143,6 +143,11 @@ namespace MenuOption {
const QString PhysicsShowHulls = "Draw Collision Shapes";
const QString PhysicsShowOwned = "Highlight Simulation Ownership";
const QString VerboseLogging = "Verbose Logging";
const QString PhysicsShowBulletWireframe = "Show Bullet Collision";
const QString PhysicsShowBulletAABBs = "Show Bullet Bounding Boxes";
const QString PhysicsShowBulletContactPoints = "Show Bullet Contact Points";
const QString PhysicsShowBulletConstraints = "Show Bullet Constraints";
const QString PhysicsShowBulletConstraintLimits = "Show Bullet Constraint Limits";
const QString PipelineWarnings = "Log Render Pipeline Warnings";
const QString Preferences = "General...";
const QString Quit = "Quit";

View file

@ -24,6 +24,9 @@
/**jsdoc
* @namespace SpeechRecognizer
*
* @hifi-interface
* @hifi-client-entity
*/
class SpeechRecognizer : public QObject, public Dependency {
Q_OBJECT

View file

@ -28,6 +28,10 @@ class AudioScope : public QObject, public Dependency {
/**jsdoc
* The AudioScope API helps control the Audio Scope features in Interface
* @namespace AudioScope
*
* @hifi-interface
* @hifi-client-entity
*
* @property {number} scopeInput <em>Read-only.</em>
* @property {number} scopeOutputLeft <em>Read-only.</em>
* @property {number} scopeOutputRight <em>Read-only.</em>

View file

@ -30,6 +30,9 @@
/**jsdoc
* The AvatarManager API has properties and methods which manage Avatars within the same domain.
* @namespace AvatarManager
*
* @hifi-interface
* @hifi-client-entity
*/
class AvatarManager : public AvatarHashMap {

View file

@ -2050,12 +2050,14 @@ void MyAvatar::preDisplaySide(RenderArgs* renderArgs) {
_attachmentData[i].jointName.compare("RightEye", Qt::CaseInsensitive) == 0 ||
_attachmentData[i].jointName.compare("HeadTop_End", Qt::CaseInsensitive) == 0 ||
_attachmentData[i].jointName.compare("Face", Qt::CaseInsensitive) == 0) {
uint8_t modelRenderTagBits = shouldDrawHead ? render::ItemKey::TAG_BITS_0 : render::ItemKey::TAG_BITS_NONE;
modelRenderTagBits |= render::ItemKey::TAG_BITS_1;
_attachmentModels[i]->setVisibleInScene(true, qApp->getMain3DScene(),
modelRenderTagBits, false);
_attachmentModels[i]->setVisibleInScene(shouldDrawHead, qApp->getMain3DScene(),
render::ItemKey::TAG_BITS_NONE, true);
_attachmentModels[i]->setCanCastShadow(shouldDrawHead, qApp->getMain3DScene(),
render::ItemKey::TAG_BITS_NONE, true);
uint8_t castShadowRenderTagBits = render::ItemKey::TAG_BITS_0 | render::ItemKey::TAG_BITS_1;
_attachmentModels[i]->setCanCastShadow(true, qApp->getMain3DScene(),
castShadowRenderTagBits, false);
}
}
}

View file

@ -29,6 +29,9 @@
/**jsdoc
* The FaceTracker API helps manage facial tracking hardware.
* @namespace FaceTracker
*
* @hifi-interface
* @hifi-client-entity
*/
class DdeFaceTracker : public FaceTracker, public Dependency {

View file

@ -18,6 +18,10 @@
* The Picks API lets you create and manage objects for repeatedly calculating intersections in different ways.
*
* @namespace Picks
*
* @hifi-interface
* @hifi-client-entity
*
* @property PICK_NOTHING {number} A filter flag. Don't intersect with anything.
* @property PICK_ENTITIES {number} A filter flag. Include entities when intersecting.
* @property PICK_OVERLAYS {number} A filter flag. Include overlays when intersecting.

View file

@ -19,6 +19,9 @@
* Pointers can also be configured to automatically generate PointerEvents.
*
* @namespace Pointers
*
* @hifi-interface
* @hifi-client-entity
*/
class PointerScriptingInterface : public QObject, public Dependency {

View file

@ -38,6 +38,9 @@ class AccountServicesScriptingInterface : public QObject {
/**jsdoc
* The AccountServices API contains helper functions related to user connectivity
*
* @hifi-interface
* @hifi-client-entity
*
* @namespace AccountServices
* @property {string} username <em>Read-only.</em>
* @property {boolean} loggedIn <em>Read-only.</em>

View file

@ -27,8 +27,14 @@ class Audio : public AudioScriptingInterface, protected ReadWriteLockable {
/**jsdoc
* The Audio API features tools to help control audio contexts and settings.
*
*
* @namespace Audio
*
* @hifi-interface
* @hifi-client-entity
* @hifi-server-entity
* @hifi-assignment-client
*
* @property {boolean} muted
* @property {boolean} noiseReduction
* @property {number} inputVolume

View file

@ -21,6 +21,9 @@
* The Clipboard API enables you to export and import entities to and from JSON files.
*
* @namespace Clipboard
*
* @hifi-interface
* @hifi-client-entity
*/
class ClipboardScriptingInterface : public QObject {
Q_OBJECT

View file

@ -200,7 +200,10 @@ class ScriptEngine;
*
* @namespace Controller
*
* @property {Controller.Actions} Actions - Predefined actions on Interface and the user's avatar. These can be used as end
* @hifi-interface
* @hifi-client-entity
*
* @property {Controller.Actions} Actions - Predefined actions on Interface and the user's avatar. These can be used as end
* points in a {@link RouteObject} mapping. A synonym for <code>Controller.Hardware.Actions</code>.
* <em>Read-only.</em><br />
* Default mappings are provided from the <code>Controller.Hardware.Keyboard</code> and <code>Controller.Standard</code> to

View file

@ -18,6 +18,9 @@
/**jsdoc
* The GooglePoly API allows you to interact with Google Poly models direct from inside High Fidelity.
* @namespace GooglePoly
*
* @hifi-interface
* @hifi-client-entity
*/
class GooglePolyScriptingInterface : public QObject, public Dependency {

View file

@ -28,7 +28,11 @@ class QScriptEngine;
* The HMD API provides access to the HMD used in VR display mode.
*
* @namespace HMD
* @property {Vec3} position - The position of the HMD if currently in VR display mode, otherwise
*
* @hifi-interface
* @hifi-client-entity
*
* @property {Vec3} position - The position of the HMD if currently in VR display mode, otherwise
* {@link Vec3(0)|Vec3.ZERO}. <em>Read-only.</em>
* @property {Quat} orientation - The orientation of the HMD if currently in VR display mode, otherwise
* {@link Quat(0)|Quat.IDENTITY}. <em>Read-only.</em>

View file

@ -32,6 +32,9 @@ class MenuItemProperties;
* If a menu item doesn't belong to a group it is always displayed.
*
* @namespace Menu
*
* @hifi-interface
* @hifi-client-entity
*/
/**

View file

@ -86,6 +86,9 @@ protected:
* The <code>Selection</code> API provides a means of grouping together avatars, entities, and overlays in named lists.
* @namespace Selection
*
* @hifi-interface
* @hifi-client-entity
*
* @example <caption>Outline an entity when it is grabbed by a controller.</caption>
* // Create a box and copy the following text into the entity's "Script URL" field.
* (function () {

View file

@ -18,6 +18,9 @@
/**jsdoc
* The Settings API provides a facility to store and retrieve values that persist between Interface runs.
* @namespace Settings
*
* @hifi-interface
* @hifi-client-entity
*/
class SettingsScriptingInterface : public QObject {

View file

@ -28,7 +28,11 @@
* physics.
*
* @namespace Window
* @property {number} innerWidth - The width of the drawable area of the Interface window (i.e., without borders or other
*
* @hifi-interface
* @hifi-client-entity
*
* @property {number} innerWidth - The width of the drawable area of the Interface window (i.e., without borders or other
* chrome), in pixels. <em>Read-only.</em>
* @property {number} innerHeight - The height of the drawable area of the Interface window (i.e., without borders or other
* chrome), in pixels. <em>Read-only.</em>

View file

@ -26,6 +26,10 @@ class AvatarInputs : public QObject {
/**jsdoc
* API to help manage your Avatar's input
* @namespace AvatarInputs
*
* @hifi-interface
* @hifi-client-entity
*
* @property {boolean} cameraEnabled <em>Read-only.</em>
* @property {boolean} cameraMuted <em>Read-only.</em>
* @property {boolean} isHMD <em>Read-only.</em>

View file

@ -31,9 +31,6 @@
#include "EntityTree.h"
#include "ContextOverlayLogging.h"
/**jsdoc
* @namespace ContextOverlay
*/
class ContextOverlayInterface : public QObject, public Dependency {
Q_OBJECT

View file

@ -76,6 +76,10 @@ void RayToOverlayIntersectionResultFromScriptValue(const QScriptValue& object, R
* The Overlays API provides facilities to create and interact with overlays. Overlays are 2D and 3D objects visible only to
* yourself and that aren't persisted to the domain. They are used for UI.
* @namespace Overlays
*
* @hifi-interface
* @hifi-client-entity
*
* @property {Uuid} keyboardFocusOverlay - Get or set the {@link Overlays.OverlayType|web3d} overlay that has keyboard focus.
* If no overlay has keyboard focus, get returns <code>null</code>; set to <code>null</code> or {@link Uuid|Uuid.NULL} to
* clear keyboard focus.

View file

@ -37,6 +37,10 @@ public:
* API to manage animation cache resources.
* @namespace AnimationCache
*
* @hifi-interface
* @hifi-client-entity
* @hifi-assignment-client
*
* @property {number} numTotal - Total number of total resources. <em>Read-only.</em>
* @property {number} numCached - Total number of cached resource. <em>Read-only.</em>
* @property {number} sizeTotal - Size in bytes of all resources. <em>Read-only.</em>

View file

@ -41,6 +41,10 @@ class AudioStreamStatsInterface : public QObject {
/**jsdoc
* @class AudioStats.AudioStreamStats
*
* @hifi-interface
* @hifi-client-entity
*
* @property {number} lossRate <em>Read-only.</em>
* @property {number} lossCount <em>Read-only.</em>
* @property {number} lossRateWindow <em>Read-only.</em>
@ -185,6 +189,10 @@ class AudioStatsInterface : public QObject {
/**jsdoc
* Audio stats from the client.
* @namespace AudioStats
*
* @hifi-interface
* @hifi-client-entity
*
* @property {number} pingMs <em>Read-only.</em>
* @property {number} inputReadMsMax <em>Read-only.</em>
* @property {number} inputUnplayedMsMax <em>Read-only.</em>

View file

@ -29,6 +29,11 @@ public:
* API to manage sound cache resources.
* @namespace SoundCache
*
* @hifi-interface
* @hifi-client-entity
* @hifi-server-entity
* @hifi-assignment-client
*
* @property {number} numTotal - Total number of total resources. <em>Read-only.</em>
* @property {number} numCached - Total number of cached resource. <em>Read-only.</em>
* @property {number} sizeTotal - Size in bytes of all resources. <em>Read-only.</em>

View file

@ -54,6 +54,9 @@ class UserInputMapper;
* </ul>
*
* @class MappingObject
*
* @hifi-interface
* @hifi-client-entity
*/
/**jsdoc

View file

@ -36,6 +36,9 @@ class ScriptingInterface;
* types.<p>
*
* @class RouteObject
*
* @hifi-interface
* @hifi-client-entity
*/
// TODO migrate functionality to a RouteBuilder class and make the proxy defer to that

View file

@ -174,6 +174,10 @@ private:
/**jsdoc
* @namespace Reticle
*
* @hifi-interface
* @hifi-client-entity
*
* @property {boolean} allowMouseCapture
* @property {number} depth
* @property {Vec2} maximumPosition

View file

@ -94,6 +94,12 @@ void RayToEntityIntersectionResultFromScriptValue(const QScriptValue& object, Ra
* Interface has displayed and so knows about.
*
* @namespace Entities
*
* @hifi-interface
* @hifi-client-entity
* @hifi-server-entity
* @hifi-assignment-client
*
* @property {Uuid} keyboardFocusEntity - Get or set the {@link Entities.EntityType|Web} entity that has keyboard focus.
* If no entity has keyboard focus, get returns <code>null</code>; set to <code>null</code> or {@link Uuid|Uuid.NULL} to
* clear keyboard focus.

View file

@ -46,10 +46,10 @@ void GLBackend::do_setFramebuffer(const Batch& batch, size_t paramOffset) {
}
void GLBackend::do_setFramebufferSwapChain(const Batch& batch, size_t paramOffset) {
auto swapChain = batch._swapChains.get(batch._params[paramOffset]._uint);
auto swapChain = std::static_pointer_cast<FramebufferSwapChain>(batch._swapChains.get(batch._params[paramOffset]._uint));
if (swapChain) {
auto index = batch._params[paramOffset + 1]._uint;
FramebufferPointer framebuffer = static_cast<const FramebufferSwapChain*>(swapChain.get())->get(index);
const auto& framebuffer = swapChain->get(index);
setFramebuffer(framebuffer);
}
}

View file

@ -268,7 +268,7 @@ void GLBackend::do_setResourceFramebufferSwapChainTexture(const Batch& batch, si
return;
}
SwapChainPointer swapChain = batch._swapChains.get(batch._params[paramOffset + 0]._uint);
auto swapChain = std::static_pointer_cast<FramebufferSwapChain>(batch._swapChains.get(batch._params[paramOffset + 0]._uint));
if (!swapChain) {
releaseResourceTexture(slot);
@ -276,9 +276,8 @@ void GLBackend::do_setResourceFramebufferSwapChainTexture(const Batch& batch, si
}
auto index = batch._params[paramOffset + 2]._uint;
auto renderBufferSlot = batch._params[paramOffset + 3]._uint;
FramebufferPointer resourceFramebuffer = static_cast<const FramebufferSwapChain*>(swapChain.get())->get(index);
TexturePointer resourceTexture = resourceFramebuffer->getRenderBuffer(renderBufferSlot);
auto resourceFramebuffer = swapChain->get(index);
auto resourceTexture = resourceFramebuffer->getRenderBuffer(renderBufferSlot);
setResourceTexture(slot, resourceTexture);
}

View file

@ -15,18 +15,18 @@ namespace gpu {
class SwapChain {
public:
SwapChain(unsigned int size = 2U) : _size{ size } {}
SwapChain(uint8_t size = 2U) : _size{ size } {}
virtual ~SwapChain() {}
void advance() {
_frontIndex = (_frontIndex + 1) % _size;
}
unsigned int getSize() const { return _size; }
uint8_t getSize() const { return _size; }
protected:
unsigned int _size;
unsigned int _frontIndex{ 0U };
const uint8_t _size;
uint8_t _frontIndex{ 0U };
};
typedef std::shared_ptr<SwapChain> SwapChainPointer;
@ -41,16 +41,13 @@ namespace gpu {
using Type = R;
using TypePointer = std::shared_ptr<R>;
using TypeConstPointer = std::shared_ptr<const R>;
ResourceSwapChain(unsigned int size = 2U) : SwapChain{ size } {}
void reset() {
for (auto& ptr : _resources) {
ptr.reset();
ResourceSwapChain(const std::vector<TypePointer>& v) : SwapChain{ std::min<uint8_t>((uint8_t)v.size(), MAX_SIZE) } {
for (size_t i = 0; i < _size; ++i) {
_resources[i] = v[i];
}
}
TypePointer& edit(unsigned int index) { return _resources[(index + _frontIndex) % _size]; }
const TypePointer& get(unsigned int index) const { return _resources[(index + _frontIndex) % _size]; }
private:

View file

@ -24,6 +24,9 @@
/**jsdoc
* The experimental Graphics API <em>(experimental)</em> lets you query and manage certain graphics-related structures (like underlying meshes and textures) from scripting.
* @namespace Graphics
*
* @hifi-interface
* @hifi-client-entity
*/
class GraphicsScriptingInterface : public QObject, public QScriptable, public Dependency {

View file

@ -144,6 +144,9 @@ public:
* API to manage model cache resources.
* @namespace ModelCache
*
* @hifi-interface
* @hifi-client-entity
*
* @property {number} numTotal - Total number of total resources. <em>Read-only.</em>
* @property {number} numCached - Total number of cached resource. <em>Read-only.</em>
* @property {number} sizeTotal - Size in bytes of all resources. <em>Read-only.</em>

View file

@ -151,6 +151,9 @@ public:
* API to manage texture cache resources.
* @namespace TextureCache
*
* @hifi-interface
* @hifi-client-entity
*
* @property {number} numTotal - Total number of total resources. <em>Read-only.</em>
* @property {number} numCached - Total number of cached resource. <em>Read-only.</em>
* @property {number} sizeTotal - Size in bytes of all resources. <em>Read-only.</em>

View file

@ -33,6 +33,11 @@ const QString GET_PLACE = "/api/v1/places/%1";
* The location API provides facilities related to your current location in the metaverse.
*
* @namespace location
*
* @hifi-interface
* @hifi-client-entity
* @hifi-assignment-client
*
* @property {Uuid} domainID - A UUID uniquely identifying the domain you're visiting. Is {@link Uuid|Uuid.NULL} if you're not
* connected to the domain or are in a serverless domain.
* <em>Read-only.</em>

View file

@ -37,6 +37,11 @@
* </ul>
*
* @namespace Messages
*
* @hifi-interface
* @hifi-client-entity
* @hifi-server-entity
* @hifi-assignment-client
*/
class MessagesClient : public QObject, public Dependency {
Q_OBJECT

View file

@ -89,6 +89,12 @@ class ScriptableResource : public QObject {
/**jsdoc
* @constructor Resource
*
* @hifi-interface
* @hifi-client-entity
* @hifi-server-entity
* @hifi-assignment-client
*
* @property {string} url - URL of this resource.
* @property {Resource.State} state - Current loading state.
*/

View file

@ -0,0 +1,54 @@
//
// PhysicsDebugDraw.cpp
// libraries/physics/src
//
// Created by Anthony Thibault 2018-4-18
// Copyright 2018 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 "PhysicsDebugDraw.h"
#include "BulletUtil.h"
#include "PhysicsLogging.h"
#include <DebugDraw.h>
#include <GLMHelpers.h>
void PhysicsDebugDraw::drawLine(const btVector3& from, const btVector3& to, const btVector3& color) {
DebugDraw::getInstance().drawRay(bulletToGLM(from), bulletToGLM(to), glm::vec4(color.getX(), color.getY(), color.getZ(), 1.0f));
}
void PhysicsDebugDraw::drawContactPoint(const btVector3& PointOnB, const btVector3& normalOnB, btScalar distance,
int lifeTime, const btVector3& color) {
glm::vec3 normal, tangent, biNormal;
generateBasisVectors(bulletToGLM(normalOnB), Vectors::UNIT_X, normal, tangent, biNormal);
btVector3 u = glmToBullet(normal);
btVector3 v = glmToBullet(tangent);
btVector3 w = glmToBullet(biNormal);
// x marks the spot, green is along the normal.
const float CONTACT_POINT_RADIUS = 0.1f;
const btVector3 GREEN(0.0f, 1.0f, 0.0f);
const btVector3 WHITE(1.0f, 1.0f, 1.0f);
drawLine(PointOnB - u * CONTACT_POINT_RADIUS, PointOnB + u * CONTACT_POINT_RADIUS, GREEN);
drawLine(PointOnB - v * CONTACT_POINT_RADIUS, PointOnB + v * CONTACT_POINT_RADIUS, WHITE);
drawLine(PointOnB - w * CONTACT_POINT_RADIUS, PointOnB + w * CONTACT_POINT_RADIUS, WHITE);
}
void PhysicsDebugDraw::reportErrorWarning(const char* warningString) {
qCWarning(physics) << "BULLET:" << warningString;
}
void PhysicsDebugDraw::draw3dText(const btVector3& location, const char* textString) {
}
void PhysicsDebugDraw::setDebugMode(int debugMode) {
_debugDrawMode = debugMode;
}
int PhysicsDebugDraw::getDebugMode() const {
return _debugDrawMode;
}

View file

@ -0,0 +1,34 @@
//
// PhysicsDebugDraw.h
// libraries/physics/src
//
// Created by Anthony Thibault 2018-4-18
// Copyright 2018 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
//
// http://bulletphysics.org/Bullet/BulletFull/classbtIDebugDraw.html
#ifndef hifi_PhysicsDebugDraw_h
#define hifi_PhysicsDebugDraw_h
#include <stdint.h>
#include <LinearMath/btIDebugDraw.h>
class PhysicsDebugDraw : public btIDebugDraw {
public:
using btIDebugDraw::drawLine;
virtual void drawLine(const btVector3& from, const btVector3& to, const btVector3& color) override;
virtual void drawContactPoint(const btVector3& PointOnB, const btVector3& normalOnB, btScalar distance,
int lifeTime, const btVector3& color) override;
virtual void reportErrorWarning(const char* warningString) override;
virtual void draw3dText(const btVector3& location, const char* textString) override;
virtual void setDebugMode(int debugMode) override;
virtual int getDebugMode() const override;
protected:
uint32_t _debugDrawMode;
};
#endif // hifi_PhysicsDebugDraw_h

View file

@ -22,6 +22,7 @@
#include "ObjectMotionState.h"
#include "PhysicsEngine.h"
#include "PhysicsHelpers.h"
#include "PhysicsDebugDraw.h"
#include "ThreadSafeDynamicsWorld.h"
#include "PhysicsLogging.h"
@ -49,6 +50,10 @@ void PhysicsEngine::init() {
_broadphaseFilter = new btDbvtBroadphase();
_constraintSolver = new btSequentialImpulseConstraintSolver;
_dynamicsWorld = new ThreadSafeDynamicsWorld(_collisionDispatcher, _broadphaseFilter, _constraintSolver, _collisionConfig);
_physicsDebugDraw.reset(new PhysicsDebugDraw());
// hook up debug draw renderer
_dynamicsWorld->setDebugDrawer(_physicsDebugDraw.get());
_ghostPairCallback = new btGhostPairCallback();
_dynamicsWorld->getPairCache()->setInternalGhostPairCallback(_ghostPairCallback);
@ -333,6 +338,10 @@ void PhysicsEngine::stepSimulation() {
_hasOutgoingChanges = true;
}
if (_physicsDebugDraw->getDebugMode()) {
_dynamicsWorld->debugDrawWorld();
}
}
class CProfileOperator {
@ -785,3 +794,49 @@ void PhysicsEngine::forEachDynamic(std::function<void(EntityDynamicPointer)> act
}
}
}
void PhysicsEngine::setShowBulletWireframe(bool value) {
int mode = _physicsDebugDraw->getDebugMode();
if (value) {
_physicsDebugDraw->setDebugMode(mode | btIDebugDraw::DBG_DrawWireframe);
} else {
_physicsDebugDraw->setDebugMode(mode & ~btIDebugDraw::DBG_DrawWireframe);
}
}
void PhysicsEngine::setShowBulletAABBs(bool value) {
int mode = _physicsDebugDraw->getDebugMode();
if (value) {
_physicsDebugDraw->setDebugMode(mode | btIDebugDraw::DBG_DrawAabb);
} else {
_physicsDebugDraw->setDebugMode(mode & ~btIDebugDraw::DBG_DrawAabb);
}
}
void PhysicsEngine::setShowBulletContactPoints(bool value) {
int mode = _physicsDebugDraw->getDebugMode();
if (value) {
_physicsDebugDraw->setDebugMode(mode | btIDebugDraw::DBG_DrawContactPoints);
} else {
_physicsDebugDraw->setDebugMode(mode & ~btIDebugDraw::DBG_DrawContactPoints);
}
}
void PhysicsEngine::setShowBulletConstraints(bool value) {
int mode = _physicsDebugDraw->getDebugMode();
if (value) {
_physicsDebugDraw->setDebugMode(mode | btIDebugDraw::DBG_DrawConstraints);
} else {
_physicsDebugDraw->setDebugMode(mode & ~btIDebugDraw::DBG_DrawConstraints);
}
}
void PhysicsEngine::setShowBulletConstraintLimits(bool value) {
int mode = _physicsDebugDraw->getDebugMode();
if (value) {
_physicsDebugDraw->setDebugMode(mode | btIDebugDraw::DBG_DrawConstraintLimits);
} else {
_physicsDebugDraw->setDebugMode(mode & ~btIDebugDraw::DBG_DrawConstraintLimits);
}
}

View file

@ -30,6 +30,7 @@
const float HALF_SIMULATION_EXTENT = 512.0f; // meters
class CharacterController;
class PhysicsDebugDraw;
// simple class for keeping track of contacts
class ContactKey {
@ -96,6 +97,12 @@ public:
void removeDynamic(const QUuid dynamicID);
void forEachDynamic(std::function<void(EntityDynamicPointer)> actor);
void setShowBulletWireframe(bool value);
void setShowBulletAABBs(bool value);
void setShowBulletContactPoints(bool value);
void setShowBulletConstraints(bool value);
void setShowBulletConstraintLimits(bool value);
private:
QList<EntityDynamicPointer> removeDynamicsForBody(btRigidBody* body);
void addObjectToDynamicsWorld(ObjectMotionState* motionState);
@ -114,6 +121,7 @@ private:
btSequentialImpulseConstraintSolver* _constraintSolver = NULL;
ThreadSafeDynamicsWorld* _dynamicsWorld = NULL;
btGhostPairCallback* _ghostPairCallback = NULL;
std::unique_ptr<PhysicsDebugDraw> _physicsDebugDraw;
ContactMap _contactMap;
CollisionEvents _collisionEvents;

View file

@ -52,9 +52,9 @@ public:
batch.setInputFormat(_vertexFormat);
batch.setInputBuffer(0, _vertexBuffer, 0, sizeof(Vertex));
batch.setIndexBuffer(gpu::UINT16, _indexBuffer, 0);
batch.setIndexBuffer(gpu::UINT32, _indexBuffer, 0);
auto numIndices = _indexBuffer->getSize() / sizeof(uint16_t);
auto numIndices = _indexBuffer->getSize() / sizeof(uint32_t);
batch.drawIndexed(gpu::LINES, (int)numIndices);
}
@ -135,9 +135,9 @@ AnimDebugDraw::AnimDebugDraw() :
AnimDebugDrawData::Vertex { glm::vec3(1.0, 1.0f, 1.0f), toRGBA(0, 0, 255, 255) },
AnimDebugDrawData::Vertex { glm::vec3(1.0, 1.0f, 2.0f), toRGBA(0, 0, 255, 255) },
});
static std::vector<uint16_t> indices({ 0, 1, 2, 3, 4, 5 });
static std::vector<uint32_t> indices({ 0, 1, 2, 3, 4, 5 });
_animDebugDrawData->_vertexBuffer->setSubData<AnimDebugDrawData::Vertex>(0, vertices);
_animDebugDrawData->_indexBuffer->setSubData<uint16_t>(0, indices);
_animDebugDrawData->_indexBuffer->setSubData<uint32_t>(0, indices);
}
AnimDebugDraw::~AnimDebugDraw() {
@ -425,9 +425,9 @@ void AnimDebugDraw::update() {
data._isVisible = (numVerts > 0);
data._indexBuffer->resize(sizeof(uint16_t) * numVerts);
data._indexBuffer->resize(sizeof(uint32_t) * numVerts);
for (int i = 0; i < numVerts; i++) {
data._indexBuffer->setSubData<uint16_t>(i, (uint16_t)i);;
data._indexBuffer->setSubData<uint32_t>(i, (uint32_t)i);;
}
});
scene->enqueueTransaction(transaction);

View file

@ -189,7 +189,6 @@ const int AntialiasingPass_NextMapSlot = 4;
Antialiasing::Antialiasing(bool isSharpenEnabled) :
_isSharpenEnabled{ isSharpenEnabled } {
_antialiasingBuffers = std::make_shared<gpu::FramebufferSwapChain>(2U);
}
Antialiasing::~Antialiasing() {
@ -325,25 +324,25 @@ void Antialiasing::run(const render::RenderContextPointer& renderContext, const
int width = sourceBuffer->getWidth();
int height = sourceBuffer->getHeight();
if (_antialiasingBuffers->get(0)) {
if (_antialiasingBuffers->get(0)->getSize() != uvec2(width, height)) {// || (sourceBuffer && (_antialiasingBuffer->getRenderBuffer(1) != sourceBuffer->getRenderBuffer(0)))) {
_antialiasingBuffers->edit(0).reset();
_antialiasingBuffers->edit(1).reset();
_antialiasingTextures[0].reset();
_antialiasingTextures[1].reset();
}
if (_antialiasingBuffers && _antialiasingBuffers->get(0) && _antialiasingBuffers->get(0)->getSize() != uvec2(width, height)) {
_antialiasingBuffers.reset();
_antialiasingTextures[0].reset();
_antialiasingTextures[1].reset();
}
if (!_antialiasingBuffers->get(0)) {
if (!_antialiasingBuffers) {
std::vector<gpu::FramebufferPointer> antiAliasingBuffers;
// Link the antialiasing FBO to texture
auto format = sourceBuffer->getRenderBuffer(0)->getTexelFormat();
auto defaultSampler = gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_LINEAR, gpu::Sampler::WRAP_CLAMP);
for (int i = 0; i < 2; i++) {
auto& antiAliasingBuffer = _antialiasingBuffers->edit(i);
antiAliasingBuffer = gpu::FramebufferPointer(gpu::Framebuffer::create("antialiasing"));
antiAliasingBuffers.emplace_back(gpu::Framebuffer::create("antialiasing"));
const auto& antiAliasingBuffer = antiAliasingBuffers.back();
_antialiasingTextures[i] = gpu::Texture::createRenderBuffer(format, width, height, gpu::Texture::SINGLE_MIP, defaultSampler);
antiAliasingBuffer->setRenderBuffer(0, _antialiasingTextures[i]);
}
_antialiasingBuffers = std::make_shared<gpu::FramebufferSwapChain>(antiAliasingBuffers);
}
gpu::doInBatch("Antialiasing::run", args->_context, [&](gpu::Batch& batch) {

View file

@ -27,6 +27,11 @@
/**jsdoc
* The Assets API allows you to communicate with the Asset Browser.
* @namespace Assets
*
* @hifi-interface
* @hifi-client-entity
* @hifi-server-entity
* @hifi-assignment-client
*/
class AssetScriptingInterface : public BaseAssetScriptingInterface, QScriptable {
Q_OBJECT

View file

@ -35,6 +35,12 @@
* of gimbal lock.
* @namespace Quat
* @variation 0
*
* @hifi-interface
* @hifi-client-entity
* @hifi-server-entity
* @hifi-assignment-client
*
* @property IDENTITY {Quat} <code>{ x: 0, y: 0, z: 0, w: 1 }</code> : The identity rotation, i.e., no rotation.
* <em>Read-only.</em>
* @example <caption>Print the <code>IDENTITY</code> value.</caption>

View file

@ -25,6 +25,10 @@ class QScriptValue;
/**jsdoc
* @namespace Recording
*
* @hifi-interface
* @hifi-client-entity
* @hifi-assignment-client
*/
class RecordingScriptingInterface : public QObject, public Dependency {
Q_OBJECT

View file

@ -112,6 +112,10 @@ namespace SceneScripting {
/**jsdoc
* @class Scene.Stage
*
* @hifi-interface
* @hifi-client-entity
*
* @property {string} backgroundMode
* @property {Scene.Stage.KeyLight} keyLight
* @property {Scene.Stage.Location} location
@ -171,6 +175,10 @@ namespace SceneScripting {
/**jsdoc
* @namespace Scene
*
* @hifi-interface
* @hifi-client-entity
*
* @property {boolean} shouldRenderAvatars
* @property {boolean} shouldRenderEntities
* @property {Scene.Stage} stage

View file

@ -89,6 +89,12 @@ public:
/**jsdoc
* @namespace Script
*
* @hifi-interface
* @hifi-client-entity
* @hifi-server-entity
* @hifi-assignment-client
*
* @property {string} context
*/
class ScriptEngine : public BaseScriptEngine, public EntitiesScriptEngineProvider {

View file

@ -29,6 +29,10 @@ class ScriptEngine;
/**jsdoc
* @namespace ScriptDiscoveryService
*
* @hifi-interface
* @hifi-client-entity
*
* @property {string} debugScriptUrl
* @property {string} defaultScriptsPath
* @property {ScriptsModel} scriptsModel

View file

@ -23,6 +23,12 @@
* hexadecimal digits.
*
* @namespace Uuid
*
* @hifi-interface
* @hifi-client-entity
* @hifi-server-entity
* @hifi-assignment-client
*
* @property NULL {Uuid} The null UUID, <code>{00000000-0000-0000-0000-000000000000}</code>.
*/

View file

@ -68,6 +68,9 @@ public:
* <p>Has properties and functions below in addition to those of <a href="http://doc.qt.io/qt-5/qabstractitemmodel.html">
* http://doc.qt.io/qt-5/qabstractitemmodel.html</a>.</p>
* @class ScriptsModel
*
* @hifi-interface
* @hifi-client-entity
*/
class ScriptsModel : public QAbstractItemModel {
Q_OBJECT

View file

@ -20,6 +20,9 @@
* <p>Has properties and functions per <a href="http://doc.qt.io/qt-5/qsortfilterproxymodel.html">
* http://doc.qt.io/qt-5/qsortfilterproxymodel.html</a>.</p>
* @class ScriptsModelFilter
*
* @hifi-interface
* @hifi-client-entity
*/
class ScriptsModelFilter : public QSortFilterProxyModel {
Q_OBJECT

View file

@ -18,7 +18,12 @@
/**jsdoc
* @namespace Users
* @property {boolean} canKick - <code>true</code> if the domain server allows the node or avatar to kick (ban) avatars,
*
* @hifi-interface
* @hifi-client-entity
* @hifi-assignment-client
*
* @property {boolean} canKick - <code>true</code> if the domain server allows the node or avatar to kick (ban) avatars,
* otherwise <code>false</code>. <em>Read-only.</em>
* @property {boolean} requestsDomainListData - <code>true</code> if the avatar requests extra data from the mixers (such as
* positional data of an avatar you've ignored). <em>Read-only.</em>

View file

@ -47,6 +47,12 @@
*
* @namespace Vec3
* @variation 0
*
* @hifi-interface
* @hifi-client-entity
* @hifi-server-entity
* @hifi-assignment-client
*
* @property {Vec3} UNIT_X - <code>{ x: 1, y: 0, z: 0 }</code> : Unit vector in the x-axis direction. <em>Read-only.</em>
* @property {Vec3} UNIT_Y - <code>{ x: 0, y: 1, z: 0 }</code> : Unit vector in the y-axis direction. <em>Read-only.</em>
* @property {Vec3} UNIT_Z - <code>{ x: 0, y: 0, z: 1 }</code> : Unit vector in the z-axis direction. <em>Read-only.</em>

View file

@ -25,6 +25,11 @@
* Helper functions to render ephemeral debug markers and lines.
* DebugDraw markers and lines are only visible locally, they are not visible by other users.
* @namespace DebugDraw
*
* @hifi-interface
* @hifi-client-entity
* @hifi-server-entity
* @hifi-assignment-client
*/
class DebugDraw : public QObject {
Q_OBJECT

View file

@ -22,6 +22,10 @@
* The Paths API provides absolute paths to the scripts and resources directories.
*
* @namespace Paths
*
* @hifi-interface
* @hifi-client-entity
*
* @deprecated The Paths API is deprecated. Use {@link Script.resolvePath} and {@link Script.resourcesPath} instead.
* @readonly
* @property {string} defaultScripts - The path to the scripts directory. <em>Read-only.</em>

View file

@ -361,6 +361,12 @@ using MeshPointer = std::shared_ptr<graphics::Mesh>;
/**jsdoc
* A handle for a mesh in an entity, such as returned by {@link Entities.getMeshes}.
* @class MeshProxy
*
* @hifi-interface
* @hifi-client-entity
* @hifi-server-entity
* @hifi-assignment-client
*
* @deprecated Use the {@link Graphics} API instead.
*/
class MeshProxy : public QObject {

View file

@ -40,6 +40,10 @@ class Camera : public QObject {
* The Camera API provides access to the "camera" that defines your view in desktop and HMD display modes.
*
* @namespace Camera
*
* @hifi-interface
* @hifi-client-entity
*
* @property position {Vec3} The position of the camera. You can set this value only when the camera is in independent mode.
* @property orientation {Quat} The orientation of the camera. You can set this value only when the camera is in independent
* mode.

View file

@ -40,6 +40,9 @@ class OffscreenQmlSurface;
/**jsdoc
* @namespace Tablet
*
* @hifi-interface
* @hifi-client-entity
*/
class TabletScriptingInterface : public QObject, public Dependency {
Q_OBJECT
@ -176,6 +179,10 @@ Q_DECLARE_METATYPE(TabletButtonsProxyModel*);
/**jsdoc
* @class TabletProxy
*
* @hifi-interface
* @hifi-client-entity
*
* @property {string} name - Name of this tablet. <em>Read-only.</em>
* @property {boolean} toolbarMode - Used to transition this tablet into and out of toolbar mode.
* When tablet is in toolbar mode, all its buttons will appear in a floating toolbar.
@ -410,6 +417,10 @@ Q_DECLARE_METATYPE(TabletProxy*);
/**jsdoc
* @class TabletButtonProxy
*
* @hifi-interface
* @hifi-client-entity
*
* @property {Uuid} uuid - Uniquely identifies this button. <em>Read-only.</em>
* @property {TabletButtonProxy.ButtonProperties} properties
*/