mirror of
https://github.com/overte-org/overte.git
synced 2025-04-23 04:33:34 +02:00
fixing merge issues with plugins
This commit is contained in:
commit
e27ba86f75
83 changed files with 656 additions and 578 deletions
cmake/externals/boostconfig
examples
ice-server/src
interface/src
libraries
avatars/src
entities-renderer/src
RenderableBoxEntityItem.cppRenderableEntityItem.hRenderableLightEntityItem.cppRenderableLineEntityItem.cppRenderableModelEntityItem.cppRenderableParticleEffectEntityItem.cppRenderablePolyVoxEntityItem.cppRenderableSphereEntityItem.cppRenderableTextEntityItem.cppRenderableWebEntityItem.cppRenderableZoneEntityItem.cpp
entities/src
EntityScriptingInterface.cppModelEntityItem.cppParticleEffectEntityItem.cppPolyVoxEntityItem.cppTextEntityItem.cppWebEntityItem.cppZoneEntityItem.cpp
fbx/src
gpu/src/gpu
input-plugins/src/input-plugins
InputDevice.hJoystick.cppKeyboardMouseDevice.cppSixenseManager.cppViveControllerManager.cppViveControllerManager.h
model/src/model
networking/src
render-utils/src
AbstractViewStateInterface.hDeferredLightingEffect.cppEnvironment.cppGeometryCache.cppModel.cppOglplusHelpers.cppRenderDeferredTask.cppTextRenderer3D.cppTextRenderer3D.hTextureCache.cppstars.slfstars.slvstarsGrid.slf
text
render/src/render
script-engine/src
shared/src
ui/src
tests/render-utils/src
tools/scribe/src
1
cmake/externals/boostconfig/CMakeLists.txt
vendored
1
cmake/externals/boostconfig/CMakeLists.txt
vendored
|
@ -16,3 +16,4 @@ ExternalProject_Get_Property(${EXTERNAL_NAME} SOURCE_DIR)
|
|||
|
||||
set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${SOURCE_DIR}/include CACHE TYPE INTERNAL)
|
||||
|
||||
set_target_properties(${EXTERNAL_NAME} PROPERTIES FOLDER "hidden/externals")
|
||||
|
|
|
@ -1211,49 +1211,6 @@ PropertiesTool = function(opts) {
|
|||
webView.setVisible(visible);
|
||||
};
|
||||
|
||||
vecToPolar = function(direction) {
|
||||
var x = direction.x;
|
||||
var y = direction.y;
|
||||
var z = direction.z;
|
||||
var pitch, yaw;
|
||||
pitch = -Math.asin(y);
|
||||
var c = Math.cos(-pitch);
|
||||
if (Math.abs(pitch) > (Math.PI / 2.0 - epsilon)) {
|
||||
//handle gymbal lock
|
||||
if (pitch > 0) {
|
||||
pitch = Math.PI / 2.0;
|
||||
} else {
|
||||
pitch = -Math.PI / 2.0;
|
||||
}
|
||||
yaw = 0.0;
|
||||
} else {
|
||||
if (z < 0) {
|
||||
if(x > 0 && x < 1) {
|
||||
yaw = Math.PI - Math.asin(x / c);
|
||||
} else {
|
||||
yaw = -Math.asin(x / c) - Math.PI;
|
||||
}
|
||||
} else {
|
||||
yaw = Math.asin(x / c);
|
||||
}
|
||||
}
|
||||
return {
|
||||
x: pitch * RADIANS_TO_DEGREES,
|
||||
y: yaw * RADIANS_TO_DEGREES,
|
||||
z: 0.0 //discard roll component
|
||||
};
|
||||
};
|
||||
|
||||
polarToVec = function(orientation) {
|
||||
var pitch = orientation.x * DEGREES_TO_RADIANS;
|
||||
var yaw = orientation.y * DEGREES_TO_RADIANS;
|
||||
return {
|
||||
x: Math.cos(pitch) * Math.sin(yaw),
|
||||
y: Math.sin(-pitch),
|
||||
z: Math.cos(pitch) * Math.cos(yaw)
|
||||
};
|
||||
}
|
||||
|
||||
selectionManager.addEventListener(function() {
|
||||
data = {
|
||||
type: 'update',
|
||||
|
@ -1267,7 +1224,8 @@ PropertiesTool = function(opts) {
|
|||
entity.properties.rotation = Quat.safeEulerAngles(entity.properties.rotation);
|
||||
}
|
||||
if (entity.properties.keyLightDirection !== undefined) {
|
||||
entity.properties.keyLightDirection = vecToPolar(entity.properties.keyLightDirection);
|
||||
entity.properties.keyLightDirection = Vec3.multiply(RADIANS_TO_DEGREES, Vec3.toPolar(entity.properties.keyLightDirection));
|
||||
entity.properties.keyLightDirection.z = 0.0;
|
||||
}
|
||||
selections.push(entity);
|
||||
}
|
||||
|
@ -1297,7 +1255,8 @@ PropertiesTool = function(opts) {
|
|||
data.properties.rotation = Quat.fromPitchYawRollDegrees(rotation.x, rotation.y, rotation.z);
|
||||
}
|
||||
if (data.properties.keyLightDirection !== undefined) {
|
||||
data.properties.keyLightDirection = polarToVec(data.properties.keyLightDirection);
|
||||
data.properties.keyLightDirection = Vec3.fromPolar(
|
||||
data.properties.keyLightDirection.x * DEGREES_TO_RADIANS, data.properties.keyLightDirection.y * DEGREES_TO_RADIANS);
|
||||
}
|
||||
Entities.editEntity(selectionManager.selections[0], data.properties);
|
||||
if (data.properties.name != undefined) {
|
||||
|
|
|
@ -116,7 +116,7 @@ SharedNetworkPeer IceServer::addOrUpdateHeartbeatingPeer(Packet& packet) {
|
|||
|
||||
if (!matchingPeer) {
|
||||
// if we don't have this sender we need to create them now
|
||||
matchingPeer = SharedNetworkPeer(new NetworkPeer(senderUUID, publicSocket, localSocket));
|
||||
matchingPeer = QSharedPointer<NetworkPeer>::create(senderUUID, publicSocket, localSocket);
|
||||
_activePeers.insert(senderUUID, matchingPeer);
|
||||
|
||||
qDebug() << "Added a new network peer" << *matchingPeer;
|
||||
|
|
|
@ -317,7 +317,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
|||
_previousScriptLocation("LastScriptLocation"),
|
||||
_scriptsLocationHandle("scriptsLocation"),
|
||||
_fieldOfView("fieldOfView", DEFAULT_FIELD_OF_VIEW_DEGREES),
|
||||
_viewTransform(),
|
||||
_scaleMirror(1.0f),
|
||||
_rotateMirror(0.0f),
|
||||
_raiseMirror(0.0f),
|
||||
|
@ -367,7 +366,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
|||
_bookmarks = new Bookmarks(); // Before setting up the menu
|
||||
|
||||
_runningScriptsWidget = new RunningScriptsWidget(_window);
|
||||
_renderEngine->addTask(render::TaskPointer(new RenderDeferredTask()));
|
||||
_renderEngine->addTask(make_shared<RenderDeferredTask>());
|
||||
_renderEngine->registerScene(_main3DScene);
|
||||
|
||||
// start the nodeThread so its event loop is running
|
||||
|
@ -806,11 +805,6 @@ void Application::initializeGL() {
|
|||
}
|
||||
#endif
|
||||
|
||||
qCDebug(interfaceapp) << "GL Version: " << QString((const char*) glGetString(GL_VERSION));
|
||||
qCDebug(interfaceapp) << "GL Shader Language Version: " << QString((const char*) glGetString(GL_SHADING_LANGUAGE_VERSION));
|
||||
qCDebug(interfaceapp) << "GL Vendor: " << QString((const char*) glGetString(GL_VENDOR));
|
||||
qCDebug(interfaceapp) << "GL Renderer: " << QString((const char*) glGetString(GL_RENDERER));
|
||||
|
||||
#ifdef WIN32
|
||||
GLenum err = glewInit();
|
||||
if (GLEW_OK != err) {
|
||||
|
@ -825,6 +819,12 @@ void Application::initializeGL() {
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
qCDebug(interfaceapp) << "GL Version: " << QString((const char*) glGetString(GL_VERSION));
|
||||
qCDebug(interfaceapp) << "GL Shader Language Version: " << QString((const char*) glGetString(GL_SHADING_LANGUAGE_VERSION));
|
||||
qCDebug(interfaceapp) << "GL Vendor: " << QString((const char*) glGetString(GL_VENDOR));
|
||||
qCDebug(interfaceapp) << "GL Renderer: " << QString((const char*) glGetString(GL_RENDERER));
|
||||
|
||||
#if defined(Q_OS_LINUX)
|
||||
// TODO: Write the correct code for Linux...
|
||||
/* if (wglewGetExtension("WGL_EXT_swap_control")) {
|
||||
|
@ -994,7 +994,6 @@ void Application::paintGL() {
|
|||
(_myAvatar->getOrientation() * glm::quat(glm::vec3(0.0f, _rotateMirror, 0.0f))) *
|
||||
glm::vec3(0.0f, 0.0f, -1.0f) * MIRROR_FULLSCREEN_DISTANCE * _scaleMirror);
|
||||
}
|
||||
Q_ASSERT(_offscreenContext->getContext() == QOpenGLContext::currentContext());
|
||||
|
||||
// Update camera position
|
||||
if (!isHMDMode()) {
|
||||
|
@ -1005,10 +1004,6 @@ void Application::paintGL() {
|
|||
// FIXME: it's happening again in the updateSHadow and it shouldn't, this should be the place
|
||||
_myCamera.loadViewFrustum(_viewFrustum);
|
||||
|
||||
if (getShadowsEnabled()) {
|
||||
renderArgs._renderMode = RenderArgs::SHADOW_RENDER_MODE;
|
||||
updateShadowMap(&renderArgs);
|
||||
}
|
||||
|
||||
renderArgs._renderMode = RenderArgs::DEFAULT_RENDER_MODE;
|
||||
|
||||
|
@ -1017,6 +1012,7 @@ void Application::paintGL() {
|
|||
QSize size = textureCache->getFrameBufferSize();
|
||||
{
|
||||
PROFILE_RANGE(__FUNCTION__ "/mainRender");
|
||||
|
||||
{
|
||||
PROFILE_RANGE(__FUNCTION__ "/clear");
|
||||
doInBatch(&renderArgs, [&](gpu::Batch& batch) {
|
||||
|
@ -1112,9 +1108,7 @@ void Application::paintGL() {
|
|||
GLsync sync = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
|
||||
#endif
|
||||
_offscreenContext->doneCurrent();
|
||||
Q_ASSERT(!QOpenGLContext::currentContext());
|
||||
displayPlugin->preDisplay();
|
||||
Q_ASSERT(QOpenGLContext::currentContext());
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
#else
|
||||
|
@ -1133,7 +1127,6 @@ void Application::paintGL() {
|
|||
displayPlugin->finishFrame();
|
||||
}
|
||||
|
||||
Q_ASSERT(!QOpenGLContext::currentContext());
|
||||
_offscreenContext->makeCurrent();
|
||||
_frameCount++;
|
||||
Stats::getInstance()->setRenderDetails(renderArgs._details);
|
||||
|
@ -1184,9 +1177,7 @@ void Application::resizeGL() {
|
|||
DependencyManager::get<TextureCache>()->setFrameBufferSize(fromGlm(renderSize));
|
||||
|
||||
// Possible change in aspect ratio
|
||||
_myCamera.setProjection(glm::perspective(glm::radians(_fieldOfView.get()),
|
||||
aspect(getCanvasSize()), DEFAULT_NEAR_CLIP, DEFAULT_FAR_CLIP));
|
||||
updateProjectionMatrix();
|
||||
loadViewFrustum(_myCamera, _viewFrustum);
|
||||
}
|
||||
|
||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||
|
@ -1198,18 +1189,6 @@ void Application::resizeGL() {
|
|||
}
|
||||
}
|
||||
|
||||
void Application::updateProjectionMatrix() {
|
||||
updateProjectionMatrix(_myCamera);
|
||||
}
|
||||
|
||||
void Application::updateProjectionMatrix(Camera& camera, bool updateViewFrustum) {
|
||||
_projectionMatrix = camera.getProjection();
|
||||
// Tell our viewFrustum about this change, using the application camera
|
||||
if (updateViewFrustum) {
|
||||
camera.loadViewFrustum(_viewFrustum);
|
||||
}
|
||||
}
|
||||
|
||||
bool Application::importSVOFromURL(const QString& urlString) {
|
||||
QUrl url(urlString);
|
||||
emit svoImportRequested(url.url());
|
||||
|
@ -2287,8 +2266,8 @@ void Application::shrinkMirrorView() {
|
|||
|
||||
const float HEAD_SPHERE_RADIUS = 0.1f;
|
||||
|
||||
bool Application::isLookingAtMyAvatar(Avatar* avatar) {
|
||||
glm::vec3 theirLookAt = avatar->getHead()->getLookAtPosition();
|
||||
bool Application::isLookingAtMyAvatar(AvatarSharedPointer avatar) {
|
||||
glm::vec3 theirLookAt = dynamic_pointer_cast<Avatar>(avatar)->getHead()->getLookAtPosition();
|
||||
glm::vec3 myEyePosition = _myAvatar->getHead()->getEyePosition();
|
||||
if (pointInSphere(theirLookAt, myEyePosition, HEAD_SPHERE_RADIUS * _myAvatar->getScale())) {
|
||||
return true;
|
||||
|
@ -2352,7 +2331,7 @@ void Application::updateMyAvatarLookAtPosition() {
|
|||
if (lookingAt && _myAvatar != lookingAt.get()) {
|
||||
// If I am looking at someone else, look directly at one of their eyes
|
||||
isLookingAtSomeone = true;
|
||||
Head* lookingAtHead = static_cast<Avatar*>(lookingAt.get())->getHead();
|
||||
auto lookingAtHead = static_pointer_cast<Avatar>(lookingAt)->getHead();
|
||||
|
||||
const float MAXIMUM_FACE_ANGLE = 65.0f * RADIANS_PER_DEGREE;
|
||||
glm::vec3 lookingAtFaceOrientation = lookingAtHead->getFinalOrientationInWorldFrame() * IDENTITY_FRONT;
|
||||
|
@ -3164,6 +3143,24 @@ void Application::queryOctree(NodeType_t serverType, PacketType::Value packetTyp
|
|||
});
|
||||
}
|
||||
|
||||
// loadViewFrustum()
|
||||
//
|
||||
// Description: this will load the view frustum bounds for EITHER the head
|
||||
// or the "myCamera".
|
||||
//
|
||||
void Application::loadViewFrustum(Camera& camera, ViewFrustum& viewFrustum) {
|
||||
PROFILE_RANGE(__FUNCTION__);
|
||||
// We will use these below, from either the camera or head vectors calculated above
|
||||
viewFrustum.setProjection(camera.getProjection());
|
||||
|
||||
// Set the viewFrustum up with the correct position and orientation of the camera
|
||||
viewFrustum.setPosition(camera.getPosition());
|
||||
viewFrustum.setOrientation(camera.getRotation());
|
||||
|
||||
// Ask the ViewFrustum class to calculate our corners
|
||||
viewFrustum.calculate();
|
||||
}
|
||||
|
||||
bool Application::isHMDMode() const {
|
||||
return getActiveDisplayPlugin()->isHmd();
|
||||
}
|
||||
|
@ -3181,12 +3178,6 @@ glm::vec3 Application::getSunDirection() {
|
|||
// FIXME, preprocessor guard this check to occur only in DEBUG builds
|
||||
static QThread * activeRenderingThread = nullptr;
|
||||
|
||||
void Application::updateShadowMap(RenderArgs* renderArgs) {
|
||||
}
|
||||
|
||||
void Application::setupWorldLight(RenderArgs* renderArgs) {
|
||||
}
|
||||
|
||||
bool Application::shouldRenderMesh(float largestDimension, float distanceToCamera) {
|
||||
return DependencyManager::get<LODManager>()->shouldRenderMesh(largestDimension, distanceToCamera);
|
||||
}
|
||||
|
@ -3430,23 +3421,8 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se
|
|||
PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "Application::displaySide()");
|
||||
|
||||
// load the view frustum
|
||||
theCamera.loadViewFrustum(_displayViewFrustum);
|
||||
loadViewFrustum(theCamera, _displayViewFrustum);
|
||||
|
||||
glm::quat rotation = theCamera.getRotation();
|
||||
// Equivalent to what is happening with _untranslatedViewMatrix and the _viewMatrixTranslation
|
||||
// the viewTransofmr object is updatded with the correct values and saved,
|
||||
// this is what is used for rendering the Entities and avatars
|
||||
Transform viewTransform;
|
||||
viewTransform.setTranslation(theCamera.getPosition());
|
||||
viewTransform.setRotation(theCamera.getRotation());
|
||||
setViewTransform(viewTransform);
|
||||
|
||||
// Setup 3D lights (after the camera transform, so that they are positioned in world space)
|
||||
{
|
||||
PerformanceTimer perfTimer("lights");
|
||||
setupWorldLight(renderArgs);
|
||||
}
|
||||
|
||||
// TODO fix shadows and make them use the GPU library
|
||||
|
||||
// The pending changes collecting the changes here
|
||||
|
@ -3454,8 +3430,8 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se
|
|||
|
||||
// Background rendering decision
|
||||
if (BackgroundRenderData::_item == 0) {
|
||||
auto backgroundRenderData = BackgroundRenderData::Pointer(new BackgroundRenderData(&_environment));
|
||||
auto backgroundRenderPayload = render::PayloadPointer(new BackgroundRenderData::Payload(backgroundRenderData));
|
||||
auto backgroundRenderData = make_shared<BackgroundRenderData>(&_environment);
|
||||
auto backgroundRenderPayload = make_shared<BackgroundRenderData::Payload>(backgroundRenderData);
|
||||
BackgroundRenderData::_item = _main3DScene->allocateID();
|
||||
pendingChanges.resetItem(WorldBoxRenderData::_item, backgroundRenderPayload);
|
||||
} else {
|
||||
|
@ -3487,8 +3463,8 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se
|
|||
|
||||
// Make sure the WorldBox is in the scene
|
||||
if (WorldBoxRenderData::_item == 0) {
|
||||
auto worldBoxRenderData = WorldBoxRenderData::Pointer(new WorldBoxRenderData());
|
||||
auto worldBoxRenderPayload = render::PayloadPointer(new WorldBoxRenderData::Payload(worldBoxRenderData));
|
||||
auto worldBoxRenderData = make_shared<WorldBoxRenderData>();
|
||||
auto worldBoxRenderPayload = make_shared<WorldBoxRenderData::Payload>(worldBoxRenderData);
|
||||
|
||||
WorldBoxRenderData::_item = _main3DScene->allocateID();
|
||||
|
||||
|
@ -3576,18 +3552,6 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se
|
|||
activeRenderingThread = nullptr;
|
||||
}
|
||||
|
||||
void Application::setViewTransform(const Transform& view) {
|
||||
_viewTransform = view;
|
||||
}
|
||||
|
||||
void Application::getModelViewMatrix(glm::dmat4* modelViewMatrix) {
|
||||
(*modelViewMatrix) = glm::inverse(_displayViewFrustum.getView());
|
||||
}
|
||||
|
||||
void Application::getProjectionMatrix(glm::dmat4* projectionMatrix) {
|
||||
*projectionMatrix = _displayViewFrustum.getProjection();
|
||||
}
|
||||
|
||||
bool Application::getShadowsEnabled() {
|
||||
Menu* menubar = Menu::getInstance();
|
||||
return menubar->isOptionChecked(MenuOption::SimpleShadows) ||
|
||||
|
@ -3601,6 +3565,7 @@ bool Application::getCascadeShadowsEnabled() {
|
|||
void Application::renderRearViewMirror(RenderArgs* renderArgs, const QRect& region, bool billboard) {
|
||||
auto originalViewport = renderArgs->_viewport;
|
||||
// Grab current viewport to reset it at the end
|
||||
|
||||
float aspect = (float)region.width() / region.height();
|
||||
float fov = MIRROR_FIELD_OF_VIEW;
|
||||
|
||||
|
@ -3666,8 +3631,12 @@ void Application::renderRearViewMirror(RenderArgs* renderArgs, const QRect& regi
|
|||
}
|
||||
|
||||
bool updateViewFrustum = false;
|
||||
updateProjectionMatrix(_mirrorCamera, updateViewFrustum);
|
||||
loadViewFrustum(_mirrorCamera, _viewFrustum);
|
||||
|
||||
// render rear mirror view
|
||||
displaySide(renderArgs, _mirrorCamera, true, billboard);
|
||||
|
||||
renderArgs->_viewport = originalViewport;
|
||||
}
|
||||
|
||||
void Application::resetSensors() {
|
||||
|
@ -4689,7 +4658,11 @@ void Application::friendsWindowClosed() {
|
|||
}
|
||||
|
||||
void Application::postLambdaEvent(std::function<void()> f) {
|
||||
QCoreApplication::postEvent(this, new LambdaEvent(f));
|
||||
if (this->thread() == QThread::currentThread()) {
|
||||
f();
|
||||
} else {
|
||||
QCoreApplication::postEvent(this, new LambdaEvent(f));
|
||||
}
|
||||
}
|
||||
|
||||
void Application::initPlugins() {
|
||||
|
|
|
@ -237,10 +237,6 @@ public:
|
|||
|
||||
float getFps() const { return _fps; }
|
||||
|
||||
virtual const Transform& getViewTransform() const { return _viewTransform; }
|
||||
virtual Transform& getViewTransform() { return _viewTransform; }
|
||||
void setViewTransform(const Transform& view);
|
||||
|
||||
float getFieldOfView() { return _fieldOfView.get(); }
|
||||
void setFieldOfView(float fov) { _fieldOfView.set(fov); }
|
||||
|
||||
|
@ -257,14 +253,11 @@ public:
|
|||
|
||||
void resetProfile(const QString& username);
|
||||
|
||||
virtual void setupWorldLight(RenderArgs* renderArgs);
|
||||
virtual bool shouldRenderMesh(float largestDimension, float distanceToCamera);
|
||||
|
||||
QImage renderAvatarBillboard(RenderArgs* renderArgs);
|
||||
|
||||
void displaySide(RenderArgs* renderArgs, Camera& whichCamera, bool selfAvatarOnly = false, bool billboard = false);
|
||||
void getModelViewMatrix(glm::dmat4* modelViewMatrix);
|
||||
void getProjectionMatrix(glm::dmat4* projectionMatrix);
|
||||
|
||||
virtual const glm::vec3& getShadowDistances() const { return _shadowDistances; }
|
||||
virtual ViewFrustum* getCurrentViewFrustum() { return getDisplayViewFrustum(); }
|
||||
|
@ -301,8 +294,8 @@ public:
|
|||
|
||||
QStringList getRunningScripts() { return _scriptEnginesHash.keys(); }
|
||||
ScriptEngine* getScriptEngine(QString scriptHash) { return _scriptEnginesHash.contains(scriptHash) ? _scriptEnginesHash[scriptHash] : NULL; }
|
||||
|
||||
bool isLookingAtMyAvatar(Avatar* avatar);
|
||||
|
||||
bool isLookingAtMyAvatar(AvatarSharedPointer avatar);
|
||||
|
||||
float getRenderResolutionScale() const;
|
||||
int getRenderAmbientLight() const;
|
||||
|
@ -460,8 +453,6 @@ private slots:
|
|||
|
||||
private:
|
||||
void resetCameras(Camera& camera, const glm::uvec2& size);
|
||||
void updateProjectionMatrix();
|
||||
void updateProjectionMatrix(Camera& camera, bool updateViewFrustum = true);
|
||||
|
||||
void sendPingPackets();
|
||||
|
||||
|
@ -491,10 +482,10 @@ private:
|
|||
void renderLookatIndicator(glm::vec3 pointOfInterest);
|
||||
|
||||
void queryOctree(NodeType_t serverType, PacketType::Value packetType, NodeToJurisdictionMap& jurisdictions);
|
||||
void loadViewFrustum(Camera& camera, ViewFrustum& viewFrustum);
|
||||
|
||||
glm::vec3 getSunDirection();
|
||||
|
||||
void updateShadowMap(RenderArgs* renderArgs);
|
||||
void renderRearViewMirror(RenderArgs* renderArgs, const QRect& region, bool billboard = false);
|
||||
void setMenuShortcutsEnabled(bool enabled);
|
||||
|
||||
|
@ -557,9 +548,6 @@ private:
|
|||
Setting::Handle<QString> _scriptsLocationHandle;
|
||||
Setting::Handle<float> _fieldOfView;
|
||||
|
||||
Transform _viewTransform;
|
||||
glm::mat4 _projectionMatrix;
|
||||
|
||||
float _scaleMirror;
|
||||
float _rotateMirror;
|
||||
float _raiseMirror;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include <mutex>
|
||||
|
||||
#include <QElapsedTimer>
|
||||
|
||||
#include <gpu/GPUConfig.h>
|
||||
#include <gpu/Batch.h>
|
||||
#include <gpu/Context.h>
|
||||
#include <NumericalConstants.h>
|
||||
|
@ -24,9 +24,12 @@
|
|||
#include <RenderArgs.h>
|
||||
#include <ViewFrustum.h>
|
||||
|
||||
#include "../../libraries/render-utils/standardTransformPNTC_vert.h"
|
||||
#include "../../libraries/render-utils/stars_vert.h"
|
||||
#include "../../libraries/render-utils/stars_frag.h"
|
||||
|
||||
#include "../../libraries/render-utils/standardTransformPNTC_vert.h"
|
||||
#include "../../libraries/render-utils/starsGrid_frag.h"
|
||||
|
||||
//static const float TILT = 0.23f;
|
||||
static const float TILT = 0.0f;
|
||||
static const unsigned int STARFIELD_NUM_STARS = 50000;
|
||||
|
@ -34,11 +37,11 @@ static const unsigned int STARFIELD_SEED = 1;
|
|||
static const float STAR_COLORIZATION = 0.1f;
|
||||
|
||||
static const float TAU = 6.28318530717958f;
|
||||
static const float HALF_TAU = TAU / 2.0f;
|
||||
static const float QUARTER_TAU = TAU / 4.0f;
|
||||
static const float MILKY_WAY_WIDTH = TAU / 30.0f; // width in radians of one half of the Milky Way
|
||||
static const float MILKY_WAY_INCLINATION = 0.0f; // angle of Milky Way from horizontal in degrees
|
||||
static const float MILKY_WAY_RATIO = 0.4f;
|
||||
//static const float HALF_TAU = TAU / 2.0f;
|
||||
//static const float QUARTER_TAU = TAU / 4.0f;
|
||||
//static const float MILKY_WAY_WIDTH = TAU / 30.0f; // width in radians of one half of the Milky Way
|
||||
//static const float MILKY_WAY_INCLINATION = 0.0f; // angle of Milky Way from horizontal in degrees
|
||||
//static const float MILKY_WAY_RATIO = 0.4f;
|
||||
static const char* UNIFORM_TIME_NAME = "iGlobalTime";
|
||||
|
||||
|
||||
|
@ -55,9 +58,11 @@ static float frand() {
|
|||
}
|
||||
|
||||
// Produce a random radian value between 0 and 2 PI (TAU)
|
||||
/*
|
||||
static float rrand() {
|
||||
return frand() * TAU;
|
||||
}
|
||||
*/
|
||||
|
||||
// http://mathworld.wolfram.com/SpherePointPicking.html
|
||||
static vec2 randPolar() {
|
||||
|
@ -107,52 +112,81 @@ unsigned computeStarColor(float colorization) {
|
|||
return red | (green << 8) | (blue << 16);
|
||||
}
|
||||
|
||||
struct StarVertex {
|
||||
vec4 position;
|
||||
vec4 colorAndSize;
|
||||
};
|
||||
|
||||
// FIXME star colors
|
||||
void Stars::render(RenderArgs* renderArgs, float alpha) {
|
||||
static gpu::BufferPointer vertexBuffer;
|
||||
static gpu::Stream::FormatPointer streamFormat;
|
||||
static gpu::Element positionElement, colorElement;
|
||||
static gpu::PipelinePointer _pipeline;
|
||||
static gpu::PipelinePointer _gridPipeline;
|
||||
static gpu::PipelinePointer _starsPipeline;
|
||||
static int32_t _timeSlot{ -1 };
|
||||
static std::once_flag once;
|
||||
|
||||
const int VERTICES_SLOT = 0;
|
||||
const int COLOR_SLOT = 2;
|
||||
const int COLOR_SLOT = 1;
|
||||
|
||||
std::call_once(once, [&] {
|
||||
{
|
||||
auto vs = gpu::ShaderPointer(gpu::Shader::createVertex(std::string(standardTransformPNTC_vert)));
|
||||
auto ps = gpu::ShaderPointer(gpu::Shader::createPixel(std::string(starsGrid_frag)));
|
||||
auto program = gpu::ShaderPointer(gpu::Shader::createProgram(vs, ps));
|
||||
gpu::Shader::makeProgram((*program));
|
||||
_timeSlot = program->getBuffers().findLocation(UNIFORM_TIME_NAME);
|
||||
if (_timeSlot == gpu::Shader::INVALID_LOCATION) {
|
||||
_timeSlot = program->getUniforms().findLocation(UNIFORM_TIME_NAME);
|
||||
}
|
||||
auto state = gpu::StatePointer(new gpu::State());
|
||||
// enable decal blend
|
||||
state->setDepthTest(gpu::State::DepthTest(false));
|
||||
state->setBlendFunction(true, gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA);
|
||||
_gridPipeline.reset(gpu::Pipeline::create(program, state));
|
||||
}
|
||||
{
|
||||
auto vs = gpu::ShaderPointer(gpu::Shader::createVertex(std::string(stars_vert)));
|
||||
auto ps = gpu::ShaderPointer(gpu::Shader::createPixel(std::string(stars_frag)));
|
||||
auto program = gpu::ShaderPointer(gpu::Shader::createProgram(vs, ps));
|
||||
gpu::Shader::makeProgram((*program));
|
||||
auto state = gpu::StatePointer(new gpu::State());
|
||||
// enable decal blend
|
||||
state->setDepthTest(gpu::State::DepthTest(false));
|
||||
state->setBlendFunction(true, gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA);
|
||||
_starsPipeline.reset(gpu::Pipeline::create(program, state));
|
||||
|
||||
}
|
||||
|
||||
QElapsedTimer startTime;
|
||||
startTime.start();
|
||||
vertexBuffer.reset(new gpu::Buffer);
|
||||
|
||||
srand(STARFIELD_SEED);
|
||||
unsigned limit = STARFIELD_NUM_STARS;
|
||||
std::vector<vec3> points;
|
||||
std::vector<StarVertex> points;
|
||||
points.resize(limit);
|
||||
for (size_t star = 0; star < limit; ++star) {
|
||||
points[star] = fromPolar(randPolar());
|
||||
//auto color = computeStarColor(STAR_COLORIZATION);
|
||||
//vertexBuffer->append(sizeof(color), (const gpu::Byte*)&color);
|
||||
points[star].position = vec4(fromPolar(randPolar()), 1);
|
||||
float size = frand() * 5.0f + 0.5f;
|
||||
if (frand() < STAR_COLORIZATION) {
|
||||
vec3 color(frand() / 2.0f + 0.5f, frand() / 2.0f + 0.5f, frand() / 2.0f + 0.5f);
|
||||
points[star].colorAndSize = vec4(color, size);
|
||||
} else {
|
||||
vec3 color(frand() / 2.0f + 0.5f);
|
||||
points[star].colorAndSize = vec4(color, size);
|
||||
}
|
||||
}
|
||||
vertexBuffer->append(sizeof(vec3) * limit, (const gpu::Byte*)&points[0]);
|
||||
streamFormat.reset(new gpu::Stream::Format()); // 1 for everyone
|
||||
streamFormat->setAttribute(gpu::Stream::POSITION, VERTICES_SLOT, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ), 0);
|
||||
positionElement = streamFormat->getAttributes().at(gpu::Stream::POSITION)._element;
|
||||
double timeDiff = (double)startTime.nsecsElapsed() / 1000000.0; // ns to ms
|
||||
qDebug() << "Total time to generate stars: " << timeDiff << " msec";
|
||||
|
||||
auto vs = gpu::ShaderPointer(gpu::Shader::createVertex(std::string(standardTransformPNTC_vert)));
|
||||
auto ps = gpu::ShaderPointer(gpu::Shader::createPixel(std::string(stars_frag)));
|
||||
auto program = gpu::ShaderPointer(gpu::Shader::createProgram(vs, ps));
|
||||
gpu::Shader::makeProgram((*program));
|
||||
_timeSlot = program->getBuffers().findLocation(UNIFORM_TIME_NAME);
|
||||
if (_timeSlot == gpu::Shader::INVALID_LOCATION) {
|
||||
_timeSlot = program->getUniforms().findLocation(UNIFORM_TIME_NAME);
|
||||
}
|
||||
auto state = gpu::StatePointer(new gpu::State());
|
||||
// enable decal blend
|
||||
state->setDepthTest(gpu::State::DepthTest(false));
|
||||
state->setBlendFunction(true, gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA);
|
||||
_pipeline.reset(gpu::Pipeline::create(program, state));
|
||||
vertexBuffer->append(sizeof(StarVertex) * limit, (const gpu::Byte*)&points[0]);
|
||||
streamFormat.reset(new gpu::Stream::Format()); // 1 for everyone
|
||||
streamFormat->setAttribute(gpu::Stream::POSITION, VERTICES_SLOT, gpu::Element(gpu::VEC4, gpu::FLOAT, gpu::XYZW), 0);
|
||||
streamFormat->setAttribute(gpu::Stream::COLOR, COLOR_SLOT, gpu::Element(gpu::VEC4, gpu::FLOAT, gpu::RGBA));
|
||||
positionElement = streamFormat->getAttributes().at(gpu::Stream::POSITION)._element;
|
||||
colorElement = streamFormat->getAttributes().at(gpu::Stream::COLOR)._element;
|
||||
});
|
||||
|
||||
auto geometryCache = DependencyManager::get<GeometryCache>();
|
||||
|
@ -166,18 +200,31 @@ void Stars::render(RenderArgs* renderArgs, float alpha) {
|
|||
batch.setResourceTexture(0, textureCache->getWhiteTexture());
|
||||
|
||||
// Render the world lines
|
||||
batch.setPipeline(_pipeline);
|
||||
batch.setPipeline(_gridPipeline);
|
||||
static auto start = usecTimestampNow();
|
||||
float msecs = (float)(usecTimestampNow() - start) / (float)USECS_PER_MSEC;
|
||||
float secs = msecs / (float)MSECS_PER_SECOND;
|
||||
batch._glUniform1f(_timeSlot, secs);
|
||||
geometryCache->renderUnitCube(batch);
|
||||
|
||||
|
||||
glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
|
||||
|
||||
static const size_t VERTEX_STRIDE = sizeof(StarVertex);
|
||||
size_t offset = offsetof(StarVertex, position);
|
||||
gpu::BufferView posView(vertexBuffer, offset, vertexBuffer->getSize(), VERTEX_STRIDE, positionElement);
|
||||
offset = offsetof(StarVertex, colorAndSize);
|
||||
gpu::BufferView colView(vertexBuffer, offset, vertexBuffer->getSize(), VERTEX_STRIDE, colorElement);
|
||||
|
||||
// Render the stars
|
||||
geometryCache->useSimpleDrawPipeline(batch);
|
||||
batch.setPipeline(_starsPipeline);
|
||||
batch._glEnable(GL_PROGRAM_POINT_SIZE_EXT);
|
||||
batch._glEnable(GL_VERTEX_PROGRAM_POINT_SIZE);
|
||||
batch._glEnable(GL_POINT_SMOOTH);
|
||||
|
||||
batch.setInputFormat(streamFormat);
|
||||
batch.setInputBuffer(VERTICES_SLOT, gpu::BufferView(vertexBuffer, positionElement));
|
||||
batch.setInputBuffer(VERTICES_SLOT, posView);
|
||||
batch.setInputBuffer(COLOR_SLOT, colView);
|
||||
batch.draw(gpu::Primitive::POINTS, STARFIELD_NUM_STARS);
|
||||
|
||||
renderArgs->_context->render(batch);
|
||||
}
|
||||
|
|
|
@ -62,10 +62,10 @@ namespace render {
|
|||
return ItemKey::Builder::opaqueShape();
|
||||
}
|
||||
template <> const Item::Bound payloadGetBound(const AvatarSharedPointer& avatar) {
|
||||
return static_cast<Avatar*>(avatar.get())->getBounds();
|
||||
return static_pointer_cast<Avatar>(avatar)->getBounds();
|
||||
}
|
||||
template <> void payloadRender(const AvatarSharedPointer& avatar, RenderArgs* args) {
|
||||
Avatar* avatarPtr = static_cast<Avatar*>(avatar.get());
|
||||
auto avatarPtr = static_pointer_cast<Avatar>(avatar);
|
||||
bool renderLookAtVectors = Menu::getInstance()->isOptionChecked(MenuOption::RenderLookAtVectors);
|
||||
avatarPtr->setDisplayingLookatVectors(renderLookAtVectors);
|
||||
|
||||
|
@ -483,7 +483,7 @@ void Avatar::render(RenderArgs* renderArgs, const glm::vec3& cameraPosition, boo
|
|||
// quick check before falling into the code below:
|
||||
// (a 10 degree breadth of an almost 2 meter avatar kicks in at about 12m)
|
||||
const float MIN_VOICE_SPHERE_DISTANCE = 12.0f;
|
||||
if (postLighting && Menu::getInstance()->isOptionChecked(MenuOption::BlueSpeechSphere)
|
||||
if (Menu::getInstance()->isOptionChecked(MenuOption::BlueSpeechSphere)
|
||||
&& distanceToTarget > MIN_VOICE_SPHERE_DISTANCE) {
|
||||
|
||||
// render voice intensity sphere for avatars that are farther away
|
||||
|
@ -497,7 +497,7 @@ void Avatar::render(RenderArgs* renderArgs, const glm::vec3& cameraPosition, boo
|
|||
float angle = abs(angleBetween(toTarget + delta, toTarget - delta));
|
||||
float sphereRadius = getHead()->getAverageLoudness() * SPHERE_LOUDNESS_SCALING;
|
||||
|
||||
if (renderArgs->_renderMode == RenderArgs::NORMAL_RENDER_MODE && (sphereRadius > MIN_SPHERE_SIZE) &&
|
||||
if (renderArgs->_renderMode == RenderArgs::DEFAULT_RENDER_MODE && (sphereRadius > MIN_SPHERE_SIZE) &&
|
||||
(angle < MAX_SPHERE_ANGLE) && (angle > MIN_SPHERE_ANGLE)) {
|
||||
Transform transform;
|
||||
transform.setTranslation(_position);
|
||||
|
|
|
@ -49,7 +49,6 @@ void FaceModel::simulate(float deltaTime, bool fullUpdate) {
|
|||
}
|
||||
|
||||
void FaceModel::maybeUpdateNeckRotation(const JointState& parentState, const FBXJoint& joint, JointState& state) {
|
||||
Avatar* owningAvatar = static_cast<Avatar*>(_owningHead->_owningAvatar);
|
||||
// get the rotation axes in joint space and use them to adjust the rotation
|
||||
glm::mat3 axes = glm::mat3_cast(glm::quat());
|
||||
glm::mat3 inverse = glm::mat3(glm::inverse(parentState.getTransform() *
|
||||
|
|
|
@ -78,7 +78,7 @@ const float MyAvatar::ZOOM_MAX = 25.0f;
|
|||
const float MyAvatar::ZOOM_DEFAULT = 1.5f;
|
||||
|
||||
MyAvatar::MyAvatar() :
|
||||
Avatar(),
|
||||
Avatar(),
|
||||
_gravity(0.0f, 0.0f, 0.0f),
|
||||
_wasPushing(false),
|
||||
_isPushing(false),
|
||||
|
@ -305,6 +305,9 @@ void MyAvatar::updateFromTrackers(float deltaTime) {
|
|||
return;
|
||||
}
|
||||
|
||||
FaceTracker* tracker = Application::getInstance()->getActiveFaceTracker();
|
||||
bool inFacetracker = tracker && !tracker->isMuted();
|
||||
|
||||
if (inHmd) {
|
||||
estimatedPosition = extractTranslation(getHMDSensorMatrix());
|
||||
estimatedPosition.x *= -1.0f;
|
||||
|
@ -312,12 +315,17 @@ void MyAvatar::updateFromTrackers(float deltaTime) {
|
|||
|
||||
const float OCULUS_LEAN_SCALE = 0.05f;
|
||||
estimatedPosition /= OCULUS_LEAN_SCALE;
|
||||
} else {
|
||||
FaceTracker* tracker = Application::getInstance()->getActiveFaceTracker();
|
||||
if (tracker && !tracker->isMuted()) {
|
||||
estimatedPosition = tracker->getHeadTranslation();
|
||||
_trackedHeadPosition = estimatedPosition;
|
||||
estimatedRotation = glm::degrees(safeEulerAngles(tracker->getHeadRotation()));
|
||||
} else if (inFacetracker) {
|
||||
estimatedPosition = tracker->getHeadTranslation();
|
||||
_trackedHeadPosition = estimatedPosition;
|
||||
estimatedRotation = glm::degrees(safeEulerAngles(tracker->getHeadRotation()));
|
||||
if (Application::getInstance()->getCamera()->getMode() == CAMERA_MODE_MIRROR) {
|
||||
// Invert yaw and roll when in mirror mode
|
||||
// NOTE: this is kinda a hack, it's the same hack we use to make the head tilt. But it's not really a mirror
|
||||
// it just makes you feel like you're looking in a mirror because the body movements of the avatar appear to
|
||||
// match your body movements.
|
||||
YAW(estimatedRotation) *= -1.0f;
|
||||
ROLL(estimatedRotation) *= -1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -367,7 +375,7 @@ void MyAvatar::updateFromTrackers(float deltaTime) {
|
|||
// NOTE: this is kinda a hack, it's the same hack we use to make the head tilt. But it's not really a mirror
|
||||
// it just makes you feel like you're looking in a mirror because the body movements of the avatar appear to
|
||||
// match your body movements.
|
||||
if (inHmd && Application::getInstance()->getCamera()->getMode() == CAMERA_MODE_MIRROR) {
|
||||
if ((inHmd || inFacetracker) && Application::getInstance()->getCamera()->getMode() == CAMERA_MODE_MIRROR) {
|
||||
relativePosition.x = -relativePosition.x;
|
||||
}
|
||||
|
||||
|
@ -486,7 +494,7 @@ void MyAvatar::startRecording() {
|
|||
return;
|
||||
}
|
||||
if (!_recorder) {
|
||||
_recorder = RecorderPointer(new Recorder(this));
|
||||
_recorder = QSharedPointer<Recorder>::create(this);
|
||||
}
|
||||
// connect to AudioClient's signal so we get input audio
|
||||
auto audioClient = DependencyManager::get<AudioClient>();
|
||||
|
@ -538,7 +546,7 @@ void MyAvatar::loadLastRecording() {
|
|||
return;
|
||||
}
|
||||
if (!_player) {
|
||||
_player = PlayerPointer(new Player(this));
|
||||
_player = QSharedPointer<Player>::create(this);
|
||||
}
|
||||
|
||||
_player->loadRecording(_recorder->getRecording());
|
||||
|
@ -933,7 +941,7 @@ void MyAvatar::updateLookAtTargetAvatar() {
|
|||
const float GREATEST_LOOKING_AT_DISTANCE = 10.0f;
|
||||
|
||||
foreach (const AvatarSharedPointer& avatarPointer, DependencyManager::get<AvatarManager>()->getAvatarHash()) {
|
||||
Avatar* avatar = static_cast<Avatar*>(avatarPointer.get());
|
||||
auto avatar = static_pointer_cast<Avatar>(avatarPointer);
|
||||
bool isCurrentTarget = avatar->getIsLookAtTarget();
|
||||
float distanceTo = glm::length(avatar->getHead()->getEyePosition() - cameraPosition);
|
||||
avatar->setIsLookAtTarget(false);
|
||||
|
@ -966,7 +974,7 @@ void MyAvatar::updateLookAtTargetAvatar() {
|
|||
}
|
||||
auto avatarPointer = _lookAtTargetAvatar.lock();
|
||||
if (avatarPointer) {
|
||||
static_cast<Avatar*>(avatarPointer.get())->setIsLookAtTarget(true);
|
||||
static_pointer_cast<Avatar>(avatarPointer)->setIsLookAtTarget(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -794,12 +794,11 @@ void SkeletonModel::renderBoundingCollisionShapes(gpu::Batch& batch, float alpha
|
|||
// so no need to render it
|
||||
return;
|
||||
}
|
||||
Application::getInstance()->loadTranslatedViewMatrix(_translation);
|
||||
|
||||
// draw a blue sphere at the capsule endpoint
|
||||
glm::vec3 endPoint;
|
||||
_boundingShape.getEndPoint(endPoint);
|
||||
endPoint = endPoint - _translation;
|
||||
endPoint = endPoint + _translation;
|
||||
Transform transform = Transform();
|
||||
transform.setTranslation(endPoint);
|
||||
batch.setModelTransform(transform);
|
||||
|
@ -810,7 +809,7 @@ void SkeletonModel::renderBoundingCollisionShapes(gpu::Batch& batch, float alpha
|
|||
// draw a yellow sphere at the capsule startpoint
|
||||
glm::vec3 startPoint;
|
||||
_boundingShape.getStartPoint(startPoint);
|
||||
startPoint = startPoint - _translation;
|
||||
startPoint = startPoint + _translation;
|
||||
glm::vec3 axis = endPoint - startPoint;
|
||||
Transform axisTransform = Transform();
|
||||
axisTransform.setTranslation(-axis);
|
||||
|
|
|
@ -208,7 +208,7 @@ void Faceshift::receive(const QByteArray& buffer) {
|
|||
for (fsMsgPtr msg; (msg = _stream.get_message()); ) {
|
||||
switch (msg->id()) {
|
||||
case fsMsg::MSG_OUT_TRACKING_STATE: {
|
||||
const fsTrackingData& data = static_cast<fsMsgTrackingState*>(msg.get())->tracking_data();
|
||||
const fsTrackingData& data = static_pointer_cast<fsMsgTrackingState>(msg)->tracking_data();
|
||||
if ((_tracking = data.m_trackingSuccessful)) {
|
||||
glm::quat newRotation = glm::quat(data.m_headRotation.w, -data.m_headRotation.x,
|
||||
data.m_headRotation.y, -data.m_headRotation.z);
|
||||
|
@ -256,7 +256,7 @@ void Faceshift::receive(const QByteArray& buffer) {
|
|||
break;
|
||||
}
|
||||
case fsMsg::MSG_OUT_BLENDSHAPE_NAMES: {
|
||||
const vector<string>& names = static_cast<fsMsgBlendshapeNames*>(msg.get())->blendshape_names();
|
||||
const vector<string>& names = static_pointer_cast<fsMsgBlendshapeNames>(msg)->blendshape_names();
|
||||
for (size_t i = 0; i < names.size(); i++) {
|
||||
if (names[i] == "EyeBlink_L") {
|
||||
_leftBlinkIndex = i;
|
||||
|
|
|
@ -371,14 +371,14 @@ QPoint ApplicationCompositor::getPalmClickLocation(const PalmData *palm) const {
|
|||
rv.ry() = point.y;
|
||||
} else {
|
||||
MyAvatar* myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
|
||||
glm::dmat4 projection;
|
||||
qApp->getProjectionMatrix(&projection);
|
||||
glm::mat4 projection;
|
||||
qApp->getDisplayViewFrustum()->evalProjectionMatrix(projection);
|
||||
glm::quat invOrientation = glm::inverse(myAvatar->getOrientation());
|
||||
glm::vec3 eyePos = myAvatar->getDefaultEyePosition();
|
||||
glm::vec3 tip = myAvatar->getLaserPointerTipPosition(palm);
|
||||
glm::vec3 tipPos = invOrientation * (tip - eyePos);
|
||||
|
||||
glm::vec4 clipSpacePos = glm::vec4(projection * glm::dvec4(tipPos, 1.0));
|
||||
glm::vec4 clipSpacePos = glm::vec4(projection * glm::vec4(tipPos, 1.0f));
|
||||
glm::vec3 ndcSpacePos;
|
||||
if (clipSpacePos.w != 0) {
|
||||
ndcSpacePos = glm::vec3(clipSpacePos) / clipSpacePos.w;
|
||||
|
@ -549,8 +549,8 @@ void ApplicationCompositor::buildHemiVertices(
|
|||
|
||||
auto geometryCache = DependencyManager::get<GeometryCache>();
|
||||
|
||||
_hemiVertices = gpu::BufferPointer(new gpu::Buffer());
|
||||
_hemiIndices = gpu::BufferPointer(new gpu::Buffer());
|
||||
_hemiVertices = std::make_shared<gpu::Buffer>();
|
||||
_hemiIndices = std::make_shared<gpu::Buffer>();
|
||||
|
||||
|
||||
if (fov >= PI) {
|
||||
|
@ -612,7 +612,7 @@ void ApplicationCompositor::drawSphereSection(gpu::Batch& batch) {
|
|||
static const int VERTEX_DATA_SLOT = 0;
|
||||
static const int TEXTURE_DATA_SLOT = 1;
|
||||
static const int COLOR_DATA_SLOT = 2;
|
||||
gpu::Stream::FormatPointer streamFormat(new gpu::Stream::Format()); // 1 for everyone
|
||||
auto streamFormat = std::make_shared<gpu::Stream::Format>(); // 1 for everyone
|
||||
streamFormat->setAttribute(gpu::Stream::POSITION, VERTEX_DATA_SLOT, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ), 0);
|
||||
streamFormat->setAttribute(gpu::Stream::TEXCOORD, TEXTURE_DATA_SLOT, gpu::Element(gpu::VEC2, gpu::FLOAT, gpu::UV));
|
||||
streamFormat->setAttribute(gpu::Stream::COLOR, COLOR_DATA_SLOT, gpu::Element(gpu::VEC4, gpu::FLOAT, gpu::RGBA));
|
||||
|
|
|
@ -32,8 +32,8 @@
|
|||
|
||||
const vec4 CONNECTION_STATUS_BORDER_COLOR{ 1.0f, 0.0f, 0.0f, 0.8f };
|
||||
const float CONNECTION_STATUS_BORDER_LINE_WIDTH = 4.0f;
|
||||
static const float ORTHO_NEAR_CLIP = -10000;
|
||||
static const float ORTHO_FAR_CLIP = 10000;
|
||||
static const float ORTHO_NEAR_CLIP = -1000.0f;
|
||||
static const float ORTHO_FAR_CLIP = 1000.0f;
|
||||
|
||||
ApplicationOverlay::ApplicationOverlay()
|
||||
{
|
||||
|
@ -131,7 +131,7 @@ void ApplicationOverlay::renderAudioScope(RenderArgs* renderArgs) {
|
|||
batch.setResourceTexture(0, textureCache->getWhiteTexture());
|
||||
int width = renderArgs->_viewport.z;
|
||||
int height = renderArgs->_viewport.w;
|
||||
mat4 legacyProjection = glm::ortho<float>(0, width, height, 0, -1000, 1000);
|
||||
mat4 legacyProjection = glm::ortho<float>(0, width, height, 0, ORTHO_NEAR_CLIP, ORTHO_FAR_CLIP);
|
||||
batch.setProjectionTransform(legacyProjection);
|
||||
batch.setModelTransform(Transform());
|
||||
batch.setViewTransform(Transform());
|
||||
|
@ -151,7 +151,7 @@ void ApplicationOverlay::renderOverlays(RenderArgs* renderArgs) {
|
|||
batch.setResourceTexture(0, textureCache->getWhiteTexture());
|
||||
int width = renderArgs->_viewport.z;
|
||||
int height = renderArgs->_viewport.w;
|
||||
mat4 legacyProjection = glm::ortho<float>(0, width, height, 0, -1000, 1000);
|
||||
mat4 legacyProjection = glm::ortho<float>(0, width, height, 0, ORTHO_NEAR_CLIP, ORTHO_FAR_CLIP);
|
||||
batch.setProjectionTransform(legacyProjection);
|
||||
batch.setModelTransform(Transform());
|
||||
batch.setViewTransform(Transform());
|
||||
|
@ -209,7 +209,8 @@ void ApplicationOverlay::renderDomainConnectionStatusBorder(RenderArgs* renderAr
|
|||
auto geometryCache = DependencyManager::get<GeometryCache>();
|
||||
geometryCache->useSimpleDrawPipeline(batch);
|
||||
batch.setProjectionTransform(mat4());
|
||||
batch.setModelTransform(mat4());
|
||||
batch.setModelTransform(Transform());
|
||||
batch.setViewTransform(Transform());
|
||||
batch.setResourceTexture(0, DependencyManager::get<TextureCache>()->getWhiteTexture());
|
||||
batch._glLineWidth(CONNECTION_STATUS_BORDER_LINE_WIDTH);
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
#define hifi_ApplicationOverlay_h
|
||||
|
||||
#include <gpu/Texture.h>
|
||||
class QOpenGLFramebufferObject;
|
||||
|
||||
// Handles the drawing of the overlays to the screen
|
||||
// TODO, move divide up the rendering, displaying and input handling
|
||||
|
|
|
@ -31,9 +31,8 @@ void LocalModelsOverlay::update(float deltatime) {
|
|||
|
||||
void LocalModelsOverlay::render(RenderArgs* args) {
|
||||
if (_visible) {
|
||||
float glowLevel = getGlowLevel(); // FIXME, glowing removed for now
|
||||
|
||||
auto batch = args ->_batch;
|
||||
|
||||
Transform transform = Transform();
|
||||
transform.setTranslation(args->_viewFrustum->getPosition() + getPosition());
|
||||
batch->setViewTransform(transform);
|
||||
|
|
|
@ -220,7 +220,7 @@ bool Overlays::editOverlay(unsigned int id, const QScriptValue& properties) {
|
|||
|
||||
if (thisOverlay) {
|
||||
if (thisOverlay->is3D()) {
|
||||
Base3DOverlay* overlay3D = static_cast<Base3DOverlay*>(thisOverlay.get());
|
||||
auto overlay3D = std::static_pointer_cast<Base3DOverlay>(thisOverlay);
|
||||
|
||||
bool oldDrawOnHUD = overlay3D->getDrawOnHUD();
|
||||
thisOverlay->setProperties(properties);
|
||||
|
@ -282,15 +282,15 @@ unsigned int Overlays::getOverlayAtPoint(const glm::vec2& point) {
|
|||
i.previous();
|
||||
unsigned int thisID = i.key();
|
||||
if (i.value()->is3D()) {
|
||||
Base3DOverlay* thisOverlay = static_cast<Base3DOverlay*>(i.value().get());
|
||||
if (!thisOverlay->getIgnoreRayIntersection()) {
|
||||
auto thisOverlay = std::dynamic_pointer_cast<Base3DOverlay>(i.value());
|
||||
if (thisOverlay && !thisOverlay->getIgnoreRayIntersection()) {
|
||||
if (thisOverlay->findRayIntersection(origin, direction, distance, thisFace)) {
|
||||
return thisID;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Overlay2D* thisOverlay = static_cast<Overlay2D*>(i.value().get());
|
||||
if (thisOverlay->getVisible() && thisOverlay->isLoaded() &&
|
||||
auto thisOverlay = std::dynamic_pointer_cast<Overlay2D>(i.value());
|
||||
if (thisOverlay && thisOverlay->getVisible() && thisOverlay->isLoaded() &&
|
||||
thisOverlay->getBoundingRect().contains(pointCopy.x, pointCopy.y, false)) {
|
||||
return thisID;
|
||||
}
|
||||
|
@ -354,8 +354,8 @@ RayToOverlayIntersectionResult Overlays::findRayIntersection(const PickRay& ray)
|
|||
while (i.hasPrevious()) {
|
||||
i.previous();
|
||||
unsigned int thisID = i.key();
|
||||
Base3DOverlay* thisOverlay = static_cast<Base3DOverlay*>(i.value().get());
|
||||
if (thisOverlay->getVisible() && !thisOverlay->getIgnoreRayIntersection() && thisOverlay->isLoaded()) {
|
||||
auto thisOverlay = std::dynamic_pointer_cast<Base3DOverlay>(i.value());
|
||||
if (thisOverlay && thisOverlay->getVisible() && !thisOverlay->getIgnoreRayIntersection() && thisOverlay->isLoaded()) {
|
||||
float thisDistance;
|
||||
BoxFace thisFace;
|
||||
QString thisExtraInfo;
|
||||
|
@ -471,13 +471,13 @@ QSizeF Overlays::textSize(unsigned int id, const QString& text) const {
|
|||
Overlay::Pointer thisOverlay = _overlaysHUD[id];
|
||||
if (thisOverlay) {
|
||||
if (typeid(*thisOverlay) == typeid(TextOverlay)) {
|
||||
return static_cast<TextOverlay*>(thisOverlay.get())->textSize(text);
|
||||
return std::dynamic_pointer_cast<TextOverlay>(thisOverlay)->textSize(text);
|
||||
}
|
||||
} else {
|
||||
thisOverlay = _overlaysWorld[id];
|
||||
if (thisOverlay) {
|
||||
if (typeid(*thisOverlay) == typeid(Text3DOverlay)) {
|
||||
return static_cast<Text3DOverlay*>(thisOverlay.get())->textSize(text);
|
||||
return std::dynamic_pointer_cast<Text3DOverlay>(thisOverlay)->textSize(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,7 +85,6 @@ TextOverlay::TextOverlay() :
|
|||
_topMargin(DEFAULT_MARGIN),
|
||||
_fontSize(DEFAULT_FONTSIZE)
|
||||
{
|
||||
|
||||
qApp->postLambdaEvent([=] {
|
||||
static std::once_flag once;
|
||||
std::call_once(once, [] {
|
||||
|
@ -117,7 +116,7 @@ TextOverlay::TextOverlay(const TextOverlay* textOverlay) :
|
|||
});
|
||||
});
|
||||
while (!_qmlElement) {
|
||||
QThread::sleep(1);
|
||||
QThread::msleep(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -147,14 +146,12 @@ xColor TextOverlay::getBackgroundColor() {
|
|||
}
|
||||
|
||||
void TextOverlay::render(RenderArgs* args) {
|
||||
if (!_qmlElement) {
|
||||
return;
|
||||
}
|
||||
if (_visible != _qmlElement->isVisible()) {
|
||||
_qmlElement->setVisible(_visible);
|
||||
}
|
||||
float pulseLevel = updatePulse();
|
||||
static float _oldPulseLevel = 0.0f;
|
||||
if (pulseLevel != _oldPulseLevel) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -632,7 +632,7 @@ void AvatarData::loadRecording(QString filename) {
|
|||
return;
|
||||
}
|
||||
if (!_player) {
|
||||
_player = PlayerPointer(new Player(this));
|
||||
_player = QSharedPointer<Player>::create(this);
|
||||
}
|
||||
|
||||
_player->loadFromFile(filename);
|
||||
|
@ -644,7 +644,7 @@ void AvatarData::startPlaying() {
|
|||
return;
|
||||
}
|
||||
if (!_player) {
|
||||
_player = PlayerPointer(new Player(this));
|
||||
_player = QSharedPointer<Player>::create(this);
|
||||
}
|
||||
_player->startPlaying();
|
||||
}
|
||||
|
@ -746,7 +746,7 @@ void AvatarData::stopPlaying() {
|
|||
}
|
||||
}
|
||||
|
||||
void AvatarData::changeReferential(Referential *ref) {
|
||||
void AvatarData::changeReferential(Referential* ref) {
|
||||
delete _referential;
|
||||
_referential = ref;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ bool AvatarHashMap::isAvatarInRange(const glm::vec3& position, const float range
|
|||
}
|
||||
|
||||
AvatarSharedPointer AvatarHashMap::newSharedAvatar() {
|
||||
return AvatarSharedPointer(new AvatarData());
|
||||
return std::make_shared<AvatarData>();
|
||||
}
|
||||
|
||||
AvatarSharedPointer AvatarHashMap::addAvatar(const QUuid& sessionUUID, const QWeakPointer<Node>& mixerWeakPointer) {
|
||||
|
|
|
@ -202,7 +202,7 @@ void Player::loadFromFile(const QString& file) {
|
|||
if (_recording) {
|
||||
_recording->clear();
|
||||
} else {
|
||||
_recording = RecordingPointer(new Recording());
|
||||
_recording = QSharedPointer<Recording>();
|
||||
}
|
||||
readRecordingFromFile(_recording, file);
|
||||
|
||||
|
|
|
@ -417,7 +417,7 @@ RecordingPointer readRecordingFromFile(RecordingPointer recording, const QString
|
|||
|
||||
// Reset the recording passed in the arguments
|
||||
if (!recording) {
|
||||
recording.reset(new Recording());
|
||||
recording = QSharedPointer<Recording>::create();
|
||||
}
|
||||
|
||||
QDataStream fileStream(byteArray);
|
||||
|
@ -652,7 +652,7 @@ RecordingPointer readRecordingFromRecFile(RecordingPointer recording, const QStr
|
|||
timer.start();
|
||||
|
||||
if (!recording) {
|
||||
recording.reset(new Recording());
|
||||
recording = QSharedPointer<Recording>::create();
|
||||
}
|
||||
|
||||
QDataStream fileStream(byteArray);
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "RenderableDebugableEntityItem.h"
|
||||
|
||||
EntityItemPointer RenderableBoxEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
|
||||
return EntityItemPointer(new RenderableBoxEntityItem(entityID, properties));
|
||||
return std::make_shared<RenderableBoxEntityItem>(entityID, properties);
|
||||
}
|
||||
|
||||
void RenderableBoxEntityItem::render(RenderArgs* args) {
|
||||
|
|
|
@ -37,8 +37,8 @@ public:
|
|||
bool addToScene(EntityItemPointer self, std::shared_ptr<render::Scene> scene, render::PendingChanges& pendingChanges) {
|
||||
_myItem = scene->allocateID();
|
||||
|
||||
auto renderData = RenderableEntityItemProxy::Pointer(new RenderableEntityItemProxy(self));
|
||||
auto renderPayload = render::PayloadPointer(new RenderableEntityItemProxy::Payload(renderData));
|
||||
auto renderData = std::make_shared<RenderableEntityItemProxy>(self);
|
||||
auto renderPayload = std::make_shared<RenderableEntityItemProxy::Payload>(renderData);
|
||||
|
||||
pendingChanges.resetItem(_myItem, renderPayload);
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "RenderableLightEntityItem.h"
|
||||
|
||||
EntityItemPointer RenderableLightEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
|
||||
return EntityItemPointer(new RenderableLightEntityItem(entityID, properties));
|
||||
return std::make_shared<RenderableLightEntityItem>(entityID, properties);
|
||||
}
|
||||
|
||||
void RenderableLightEntityItem::render(RenderArgs* args) {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "RenderableLineEntityItem.h"
|
||||
|
||||
EntityItemPointer RenderableLineEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
|
||||
return EntityItemPointer(new RenderableLineEntityItem(entityID, properties));
|
||||
return std::make_shared<RenderableLineEntityItem>(entityID, properties);
|
||||
}
|
||||
|
||||
void RenderableLineEntityItem::updateGeometry() {
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "RenderableModelEntityItem.h"
|
||||
|
||||
EntityItemPointer RenderableModelEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
|
||||
return EntityItemPointer(new RenderableModelEntityItem(entityID, properties));
|
||||
return std::make_shared<RenderableModelEntityItem>(entityID, properties);
|
||||
}
|
||||
|
||||
RenderableModelEntityItem::~RenderableModelEntityItem() {
|
||||
|
@ -190,8 +190,8 @@ bool RenderableModelEntityItem::addToScene(EntityItemPointer self, std::shared_p
|
|||
|
||||
_myMetaItem = scene->allocateID();
|
||||
|
||||
auto renderData = RenderableModelEntityItemMeta::Pointer(new RenderableModelEntityItemMeta(self));
|
||||
auto renderPayload = render::PayloadPointer(new RenderableModelEntityItemMeta::Payload(renderData));
|
||||
auto renderData = std::make_shared<RenderableModelEntityItemMeta>(self);
|
||||
auto renderPayload = std::make_shared<RenderableModelEntityItemMeta::Payload>(renderData);
|
||||
|
||||
pendingChanges.resetItem(_myMetaItem, renderPayload);
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "RenderableParticleEffectEntityItem.h"
|
||||
|
||||
EntityItemPointer RenderableParticleEffectEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
|
||||
return EntityItemPointer(new RenderableParticleEffectEntityItem(entityID, properties));
|
||||
return std::make_shared<RenderableParticleEffectEntityItem>(entityID, properties);
|
||||
}
|
||||
|
||||
RenderableParticleEffectEntityItem::RenderableParticleEffectEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties) :
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include "RenderablePolyVoxEntityItem.h"
|
||||
|
||||
EntityItemPointer RenderablePolyVoxEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
|
||||
return EntityItemPointer(new RenderablePolyVoxEntityItem(entityID, properties));
|
||||
return std::make_shared<RenderablePolyVoxEntityItem>(entityID, properties);
|
||||
}
|
||||
|
||||
RenderablePolyVoxEntityItem::RenderablePolyVoxEntityItem(const EntityItemID& entityItemID,
|
||||
|
@ -349,15 +349,16 @@ void RenderablePolyVoxEntityItem::getModel() {
|
|||
auto mesh = _modelGeometry.getMesh();
|
||||
|
||||
const std::vector<uint32_t>& vecIndices = polyVoxMesh.getIndices();
|
||||
auto indexBuffer = new gpu::Buffer(vecIndices.size() * sizeof(uint32_t), (gpu::Byte*)vecIndices.data());
|
||||
auto indexBuffer = std::make_shared<gpu::Buffer>(vecIndices.size() * sizeof(uint32_t),
|
||||
(gpu::Byte*)vecIndices.data());
|
||||
auto indexBufferPtr = gpu::BufferPointer(indexBuffer);
|
||||
auto indexBufferView = new gpu::BufferView(indexBufferPtr, gpu::Element(gpu::SCALAR, gpu::UINT32, gpu::RAW));
|
||||
mesh->setIndexBuffer(*indexBufferView);
|
||||
|
||||
|
||||
const std::vector<PolyVox::PositionMaterialNormal>& vecVertices = polyVoxMesh.getVertices();
|
||||
auto vertexBuffer = new gpu::Buffer(vecVertices.size() * sizeof(PolyVox::PositionMaterialNormal),
|
||||
(gpu::Byte*)vecVertices.data());
|
||||
auto vertexBuffer = std::make_shared<gpu::Buffer>(vecVertices.size() * sizeof(PolyVox::PositionMaterialNormal),
|
||||
(gpu::Byte*)vecVertices.data());
|
||||
auto vertexBufferPtr = gpu::BufferPointer(vertexBuffer);
|
||||
auto vertexBufferView = new gpu::BufferView(vertexBufferPtr,
|
||||
0,
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "RenderableDebugableEntityItem.h"
|
||||
|
||||
EntityItemPointer RenderableSphereEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
|
||||
return EntityItemPointer(new RenderableSphereEntityItem(entityID, properties));
|
||||
return std::make_shared<RenderableSphereEntityItem>(entityID, properties);
|
||||
}
|
||||
|
||||
void RenderableSphereEntityItem::render(RenderArgs* args) {
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "GLMHelpers.h"
|
||||
|
||||
EntityItemPointer RenderableTextEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
|
||||
return EntityItemPointer(new RenderableTextEntityItem(entityID, properties));
|
||||
return std::make_shared<RenderableTextEntityItem>(entityID, properties);
|
||||
}
|
||||
|
||||
void RenderableTextEntityItem::render(RenderArgs* args) {
|
||||
|
|
|
@ -32,7 +32,7 @@ const float DPI = 30.47f;
|
|||
const float METERS_TO_INCHES = 39.3701f;
|
||||
|
||||
EntityItemPointer RenderableWebEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
|
||||
return EntityItemPointer(new RenderableWebEntityItem(entityID, properties));
|
||||
return std::make_shared<RenderableWebEntityItem>(entityID, properties);
|
||||
}
|
||||
|
||||
RenderableWebEntityItem::RenderableWebEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties) :
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include <PerfStat.h>
|
||||
|
||||
EntityItemPointer RenderableZoneEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
|
||||
return EntityItemPointer(new RenderableZoneEntityItem(entityID, properties));
|
||||
return std::make_shared<RenderableZoneEntityItem>(entityID, properties);
|
||||
}
|
||||
|
||||
template<typename Lambda>
|
||||
|
@ -195,8 +195,8 @@ bool RenderableZoneEntityItem::addToScene(EntityItemPointer self, std::shared_pt
|
|||
render::PendingChanges& pendingChanges) {
|
||||
_myMetaItem = scene->allocateID();
|
||||
|
||||
auto renderData = RenderableZoneEntityItemMeta::Pointer(new RenderableZoneEntityItemMeta(self));
|
||||
auto renderPayload = render::PayloadPointer(new RenderableZoneEntityItemMeta::Payload(renderData));
|
||||
auto renderData = std::make_shared<RenderableZoneEntityItemMeta>(self);
|
||||
auto renderPayload = std::make_shared<RenderableZoneEntityItemMeta::Payload>(renderData);
|
||||
|
||||
pendingChanges.resetItem(_myMetaItem, renderPayload);
|
||||
return true;
|
||||
|
|
|
@ -419,7 +419,7 @@ bool EntityScriptingInterface::setVoxels(QUuid entityID,
|
|||
return false;
|
||||
}
|
||||
|
||||
EntityItemPointer entity = static_cast<EntityItemPointer>(_entityTree->findEntityByEntityItemID(entityID));
|
||||
EntityItemPointer entity = _entityTree->findEntityByEntityItemID(entityID);
|
||||
if (!entity) {
|
||||
qCDebug(entities) << "EntityScriptingInterface::setVoxelSphere no entity with ID" << entityID;
|
||||
return false;
|
||||
|
@ -432,7 +432,7 @@ bool EntityScriptingInterface::setVoxels(QUuid entityID,
|
|||
|
||||
auto now = usecTimestampNow();
|
||||
|
||||
PolyVoxEntityItem* polyVoxEntity = static_cast<PolyVoxEntityItem*>(entity.get());
|
||||
auto polyVoxEntity = std::dynamic_pointer_cast<PolyVoxEntityItem>(entity);
|
||||
_entityTree->lockForWrite();
|
||||
actor(*polyVoxEntity);
|
||||
entity->setLastEdited(now);
|
||||
|
@ -467,8 +467,8 @@ bool EntityScriptingInterface::setPoints(QUuid entityID, std::function<bool(Line
|
|||
}
|
||||
|
||||
auto now = usecTimestampNow();
|
||||
|
||||
LineEntityItem* lineEntity = static_cast<LineEntityItem*>(entity.get());
|
||||
|
||||
auto lineEntity = std::static_pointer_cast<LineEntityItem>(entity);
|
||||
_entityTree->lockForWrite();
|
||||
bool success = actor(*lineEntity);
|
||||
entity->setLastEdited(now);
|
||||
|
|
|
@ -29,7 +29,7 @@ const float ModelEntityItem::DEFAULT_ANIMATION_FPS = 30.0f;
|
|||
|
||||
|
||||
EntityItemPointer ModelEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
|
||||
return EntityItemPointer(new ModelEntityItem(entityID, properties));
|
||||
return std::make_shared<ModelEntityItem>(entityID, properties);
|
||||
}
|
||||
|
||||
ModelEntityItem::ModelEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties) :
|
||||
|
|
|
@ -56,7 +56,7 @@ const QString ParticleEffectEntityItem::DEFAULT_TEXTURES = "";
|
|||
|
||||
|
||||
EntityItemPointer ParticleEffectEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
|
||||
return EntityItemPointer(new ParticleEffectEntityItem(entityID, properties));
|
||||
return std::make_shared<ParticleEffectEntityItem>(entityID, properties);
|
||||
}
|
||||
|
||||
// our non-pure virtual subclass for now...
|
||||
|
|
|
@ -28,12 +28,9 @@ const PolyVoxEntityItem::PolyVoxSurfaceStyle PolyVoxEntityItem::DEFAULT_VOXEL_SU
|
|||
PolyVoxEntityItem::SURFACE_MARCHING_CUBES;
|
||||
|
||||
EntityItemPointer PolyVoxEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
|
||||
return EntityItemPointer(new PolyVoxEntityItem(entityID, properties));
|
||||
return std::make_shared<PolyVoxEntityItem>(entityID, properties);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
QByteArray PolyVoxEntityItem::makeEmptyVoxelData(quint16 voxelXSize, quint16 voxelYSize, quint16 voxelZSize) {
|
||||
int rawSize = voxelXSize * voxelYSize * voxelZSize;
|
||||
|
||||
|
@ -48,8 +45,6 @@ QByteArray PolyVoxEntityItem::makeEmptyVoxelData(quint16 voxelXSize, quint16 vox
|
|||
return newVoxelData;
|
||||
}
|
||||
|
||||
|
||||
|
||||
PolyVoxEntityItem::PolyVoxEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties) :
|
||||
EntityItem(entityItemID),
|
||||
_voxelVolumeSize(PolyVoxEntityItem::DEFAULT_VOXEL_VOLUME_SIZE),
|
||||
|
|
|
@ -30,7 +30,7 @@ const xColor TextEntityItem::DEFAULT_BACKGROUND_COLOR = { 0, 0, 0};
|
|||
const bool TextEntityItem::DEFAULT_FACE_CAMERA = false;
|
||||
|
||||
EntityItemPointer TextEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
|
||||
return EntityItemPointer(new TextEntityItem(entityID, properties));
|
||||
return std::make_shared<TextEntityItem>(entityID, properties);
|
||||
}
|
||||
|
||||
TextEntityItem::TextEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties) :
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
const QString WebEntityItem::DEFAULT_SOURCE_URL("http://www.google.com");
|
||||
|
||||
EntityItemPointer WebEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
|
||||
return EntityItemPointer(new WebEntityItem(entityID, properties));
|
||||
return std::make_shared<WebEntityItem>(entityID, properties);
|
||||
}
|
||||
|
||||
WebEntityItem::WebEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties) :
|
||||
|
|
|
@ -30,7 +30,7 @@ const ShapeType ZoneEntityItem::DEFAULT_SHAPE_TYPE = SHAPE_TYPE_BOX;
|
|||
const QString ZoneEntityItem::DEFAULT_COMPOUND_SHAPE_URL = "";
|
||||
|
||||
EntityItemPointer ZoneEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) {
|
||||
return EntityItemPointer(new ZoneEntityItem(entityID, properties));
|
||||
return std::make_shared<ZoneEntityItem>(entityID, properties);
|
||||
}
|
||||
|
||||
ZoneEntityItem::ZoneEntityItem(const EntityItemID& entityItemID, const EntityItemProperties& properties) :
|
||||
|
|
|
@ -1323,7 +1323,7 @@ void buildModelMesh(ExtractedMesh& extracted) {
|
|||
model::Mesh mesh;
|
||||
|
||||
// Grab the vertices in a buffer
|
||||
gpu::BufferPointer vb(new gpu::Buffer());
|
||||
auto vb = make_shared<gpu::Buffer>();
|
||||
vb->setData(extracted.mesh.vertices.size() * sizeof(glm::vec3),
|
||||
(const gpu::Byte*) extracted.mesh.vertices.data());
|
||||
gpu::BufferView vbv(vb, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ));
|
||||
|
@ -1348,7 +1348,7 @@ void buildModelMesh(ExtractedMesh& extracted) {
|
|||
int totalAttributeSize = clusterWeightsOffset + clusterWeightsSize;
|
||||
|
||||
// Copy all attribute data in a single attribute buffer
|
||||
gpu::BufferPointer attribBuffer(new gpu::Buffer());
|
||||
auto attribBuffer = make_shared<gpu::Buffer>();
|
||||
attribBuffer->resize(totalAttributeSize);
|
||||
attribBuffer->setSubData(normalsOffset, normalsSize, (gpu::Byte*) fbxMesh.normals.constData());
|
||||
attribBuffer->setSubData(tangentsOffset, tangentsSize, (gpu::Byte*) fbxMesh.tangents.constData());
|
||||
|
@ -1407,7 +1407,7 @@ void buildModelMesh(ExtractedMesh& extracted) {
|
|||
return;
|
||||
}
|
||||
|
||||
gpu::BufferPointer ib(new gpu::Buffer());
|
||||
auto ib = make_shared<gpu::Buffer>();
|
||||
ib->resize(totalIndices * sizeof(int));
|
||||
|
||||
int indexNum = 0;
|
||||
|
@ -1437,7 +1437,7 @@ void buildModelMesh(ExtractedMesh& extracted) {
|
|||
mesh.setIndexBuffer(ibv);
|
||||
|
||||
if (parts.size()) {
|
||||
gpu::BufferPointer pb(new gpu::Buffer());
|
||||
auto pb = make_shared<gpu::Buffer>();
|
||||
pb->setData(parts.size() * sizeof(model::Mesh::Part), (const gpu::Byte*) parts.data());
|
||||
gpu::BufferView pbv(pb, gpu::Element(gpu::VEC4, gpu::UINT32, gpu::XYZW));
|
||||
mesh.setPartBuffer(pbv);
|
||||
|
@ -1926,7 +1926,7 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping,
|
|||
}
|
||||
material.id = getID(object.properties);
|
||||
|
||||
material._material = model::MaterialPointer(new model::Material());
|
||||
material._material = make_shared<model::Material>();
|
||||
material._material->setEmissive(material.emissive);
|
||||
if (glm::all(glm::equal(material.diffuse, glm::vec3(0.0f)))) {
|
||||
material._material->setDiffuse(material.diffuse);
|
||||
|
|
|
@ -131,7 +131,7 @@ void setMeshPartDefaults(FBXMeshPart& meshPart, QString materialID) {
|
|||
|
||||
meshPart.materialID = materialID;
|
||||
meshPart.opacity = 1.0;
|
||||
meshPart._material = model::MaterialPointer(new model::Material());
|
||||
meshPart._material = std::make_shared<model::Material>();
|
||||
meshPart._material->setDiffuse(glm::vec3(1.0, 1.0, 1.0));
|
||||
meshPart._material->setOpacity(1.0);
|
||||
meshPart._material->setMetallic(0.0);
|
||||
|
|
|
@ -40,97 +40,99 @@ const GLBackend::GLState::Commands makeResetStateCommands() {
|
|||
// and we have a 50/50 chance that State::DEFAULT is not yet initialized.
|
||||
// Since State::DEFAULT = State::Data() it is much easier to not use the actual State::DEFAULT
|
||||
// but another State::Data object with a default initialization.
|
||||
State::Data DEFAULT = State::Data();
|
||||
const State::Data DEFAULT = State::Data();
|
||||
|
||||
CommandPointer depthBiasCommand = CommandPointer(new CommandDepthBias(&GLBackend::do_setStateDepthBias, Vec2(DEFAULT.depthBias, DEFAULT.depthBiasSlopeScale)));
|
||||
CommandPointer stencilCommand = CommandPointer(new CommandStencil(&GLBackend::do_setStateStencil, DEFAULT.stencilActivation, DEFAULT.stencilTestFront, DEFAULT.stencilTestBack));
|
||||
auto depthBiasCommand = std::make_shared<CommandDepthBias>(&GLBackend::do_setStateDepthBias,
|
||||
Vec2(DEFAULT.depthBias, DEFAULT.depthBiasSlopeScale));
|
||||
auto stencilCommand = std::make_shared<CommandStencil>(&GLBackend::do_setStateStencil, DEFAULT.stencilActivation,
|
||||
DEFAULT.stencilTestFront, DEFAULT.stencilTestBack);
|
||||
|
||||
// The state commands to reset to default,
|
||||
// WARNING depending on the order of the State::Field enum
|
||||
return {
|
||||
CommandPointer(new Command1I(&GLBackend::do_setStateFillMode, DEFAULT.fillMode)),
|
||||
CommandPointer(new Command1I(&GLBackend::do_setStateCullMode, DEFAULT.cullMode)),
|
||||
CommandPointer(new Command1B(&GLBackend::do_setStateFrontFaceClockwise, DEFAULT.frontFaceClockwise)),
|
||||
CommandPointer(new Command1B(&GLBackend::do_setStateDepthClampEnable, DEFAULT.depthClampEnable)),
|
||||
CommandPointer(new Command1B(&GLBackend::do_setStateScissorEnable, DEFAULT.scissorEnable)),
|
||||
CommandPointer(new Command1B(&GLBackend::do_setStateMultisampleEnable, DEFAULT.multisampleEnable)),
|
||||
CommandPointer(new Command1B(&GLBackend::do_setStateAntialiasedLineEnable, DEFAULT.antialisedLineEnable)),
|
||||
std::make_shared<Command1I>(&GLBackend::do_setStateFillMode, DEFAULT.fillMode),
|
||||
std::make_shared<Command1I>(&GLBackend::do_setStateCullMode, DEFAULT.cullMode),
|
||||
std::make_shared<Command1B>(&GLBackend::do_setStateFrontFaceClockwise, DEFAULT.frontFaceClockwise),
|
||||
std::make_shared<Command1B>(&GLBackend::do_setStateDepthClampEnable, DEFAULT.depthClampEnable),
|
||||
std::make_shared<Command1B>(&GLBackend::do_setStateScissorEnable, DEFAULT.scissorEnable),
|
||||
std::make_shared<Command1B>(&GLBackend::do_setStateMultisampleEnable, DEFAULT.multisampleEnable),
|
||||
std::make_shared<Command1B>(&GLBackend::do_setStateAntialiasedLineEnable, DEFAULT.antialisedLineEnable),
|
||||
|
||||
// Depth bias has 2 fields in State but really one call in GLBackend
|
||||
CommandPointer(depthBiasCommand),
|
||||
CommandPointer(depthBiasCommand),
|
||||
|
||||
CommandPointer(new CommandDepthTest(&GLBackend::do_setStateDepthTest, DEFAULT.depthTest)),
|
||||
std::make_shared<CommandDepthTest>(&GLBackend::do_setStateDepthTest, DEFAULT.depthTest),
|
||||
|
||||
// Depth bias has 3 fields in State but really one call in GLBackend
|
||||
CommandPointer(stencilCommand),
|
||||
CommandPointer(stencilCommand),
|
||||
CommandPointer(stencilCommand),
|
||||
|
||||
CommandPointer(new Command1B(&GLBackend::do_setStateAlphaToCoverageEnable, DEFAULT.alphaToCoverageEnable)),
|
||||
std::make_shared<Command1B>(&GLBackend::do_setStateAlphaToCoverageEnable, DEFAULT.alphaToCoverageEnable),
|
||||
|
||||
CommandPointer(new Command1U(&GLBackend::do_setStateSampleMask, DEFAULT.sampleMask)),
|
||||
std::make_shared<Command1U>(&GLBackend::do_setStateSampleMask, DEFAULT.sampleMask),
|
||||
|
||||
CommandPointer(new CommandBlend(&GLBackend::do_setStateBlend, DEFAULT.blendFunction)),
|
||||
std::make_shared<CommandBlend>(&GLBackend::do_setStateBlend, DEFAULT.blendFunction),
|
||||
|
||||
CommandPointer(new Command1U(&GLBackend::do_setStateColorWriteMask, DEFAULT.colorWriteMask))
|
||||
std::make_shared<Command1U>(&GLBackend::do_setStateColorWriteMask, DEFAULT.colorWriteMask)
|
||||
};
|
||||
}
|
||||
|
||||
void generateFillMode(GLBackend::GLState::Commands& commands, State::FillMode fillMode) {
|
||||
commands.push_back(CommandPointer(new Command1I(&GLBackend::do_setStateFillMode, int32(fillMode))));
|
||||
commands.push_back(std::make_shared<Command1I>(&GLBackend::do_setStateFillMode, int32(fillMode)));
|
||||
}
|
||||
|
||||
void generateCullMode(GLBackend::GLState::Commands& commands, State::CullMode cullMode) {
|
||||
commands.push_back(CommandPointer(new Command1I(&GLBackend::do_setStateCullMode, int32(cullMode))));
|
||||
commands.push_back(std::make_shared<Command1I>(&GLBackend::do_setStateCullMode, int32(cullMode)));
|
||||
}
|
||||
|
||||
void generateFrontFaceClockwise(GLBackend::GLState::Commands& commands, bool isClockwise) {
|
||||
commands.push_back(CommandPointer(new Command1B(&GLBackend::do_setStateFrontFaceClockwise, isClockwise)));
|
||||
commands.push_back(std::make_shared<Command1B>(&GLBackend::do_setStateFrontFaceClockwise, isClockwise));
|
||||
}
|
||||
|
||||
void generateDepthClampEnable(GLBackend::GLState::Commands& commands, bool enable) {
|
||||
commands.push_back(CommandPointer(new Command1B(&GLBackend::do_setStateDepthClampEnable, enable)));
|
||||
commands.push_back(std::make_shared<Command1B>(&GLBackend::do_setStateDepthClampEnable, enable));
|
||||
}
|
||||
|
||||
void generateScissorEnable(GLBackend::GLState::Commands& commands, bool enable) {
|
||||
commands.push_back(CommandPointer(new Command1B(&GLBackend::do_setStateScissorEnable, enable)));
|
||||
commands.push_back(std::make_shared<Command1B>(&GLBackend::do_setStateScissorEnable, enable));
|
||||
}
|
||||
|
||||
void generateMultisampleEnable(GLBackend::GLState::Commands& commands, bool enable) {
|
||||
commands.push_back(CommandPointer(new Command1B(&GLBackend::do_setStateMultisampleEnable, enable)));
|
||||
commands.push_back(std::make_shared<Command1B>(&GLBackend::do_setStateMultisampleEnable, enable));
|
||||
}
|
||||
|
||||
void generateAntialiasedLineEnable(GLBackend::GLState::Commands& commands, bool enable) {
|
||||
commands.push_back(CommandPointer(new Command1B(&GLBackend::do_setStateAntialiasedLineEnable, enable)));
|
||||
commands.push_back(std::make_shared<Command1B>(&GLBackend::do_setStateAntialiasedLineEnable, enable));
|
||||
}
|
||||
|
||||
void generateDepthBias(GLBackend::GLState::Commands& commands, const State& state) {
|
||||
commands.push_back(CommandPointer(new CommandDepthBias(&GLBackend::do_setStateDepthBias, Vec2(state.getDepthBias(), state.getDepthBiasSlopeScale()))));
|
||||
commands.push_back(std::make_shared<CommandDepthBias>(&GLBackend::do_setStateDepthBias, Vec2(state.getDepthBias(), state.getDepthBiasSlopeScale())));
|
||||
}
|
||||
|
||||
void generateDepthTest(GLBackend::GLState::Commands& commands, const State::DepthTest& test) {
|
||||
commands.push_back(CommandPointer(new CommandDepthTest(&GLBackend::do_setStateDepthTest, int32(test.getRaw()))));
|
||||
commands.push_back(std::make_shared<CommandDepthTest>(&GLBackend::do_setStateDepthTest, int32(test.getRaw())));
|
||||
}
|
||||
|
||||
void generateStencil(GLBackend::GLState::Commands& commands, const State& state) {
|
||||
commands.push_back(CommandPointer(new CommandStencil(&GLBackend::do_setStateStencil, state.getStencilActivation(), state.getStencilTestFront(), state.getStencilTestBack())));
|
||||
commands.push_back(std::make_shared<CommandStencil>(&GLBackend::do_setStateStencil, state.getStencilActivation(), state.getStencilTestFront(), state.getStencilTestBack()));
|
||||
}
|
||||
|
||||
void generateAlphaToCoverageEnable(GLBackend::GLState::Commands& commands, bool enable) {
|
||||
commands.push_back(CommandPointer(new Command1B(&GLBackend::do_setStateAlphaToCoverageEnable, enable)));
|
||||
commands.push_back(std::make_shared<Command1B>(&GLBackend::do_setStateAlphaToCoverageEnable, enable));
|
||||
}
|
||||
|
||||
void generateSampleMask(GLBackend::GLState::Commands& commands, uint32 mask) {
|
||||
commands.push_back(CommandPointer(new Command1U(&GLBackend::do_setStateSampleMask, mask)));
|
||||
commands.push_back(std::make_shared<Command1U>(&GLBackend::do_setStateSampleMask, mask));
|
||||
}
|
||||
|
||||
void generateBlend(GLBackend::GLState::Commands& commands, const State& state) {
|
||||
commands.push_back(CommandPointer(new CommandBlend(&GLBackend::do_setStateBlend, state.getBlendFunction())));
|
||||
commands.push_back(std::make_shared<CommandBlend>(&GLBackend::do_setStateBlend, state.getBlendFunction()));
|
||||
}
|
||||
|
||||
void generateColorWriteMask(GLBackend::GLState::Commands& commands, uint32 mask) {
|
||||
commands.push_back(CommandPointer(new Command1U(&GLBackend::do_setStateColorWriteMask, mask)));
|
||||
commands.push_back(std::make_shared<Command1U>(&GLBackend::do_setStateColorWriteMask, mask));
|
||||
}
|
||||
|
||||
GLBackend::GLState* GLBackend::syncGPUObject(const State& state) {
|
||||
|
|
|
@ -32,7 +32,11 @@ void GLBackend::do_setProjectionTransform(Batch& batch, uint32 paramOffset) {
|
|||
|
||||
void GLBackend::do_setViewportTransform(Batch& batch, uint32 paramOffset) {
|
||||
memcpy(&_transform._viewport, batch.editData(batch._params[paramOffset]._uint), sizeof(Vec4i));
|
||||
|
||||
// Where we assign the GL viewport
|
||||
glViewport(_transform._viewport.x, _transform._viewport.y, _transform._viewport.z, _transform._viewport.w);
|
||||
|
||||
// The Viewport is tagged invalid because the CameraTransformUBO is not up to date and willl need update on next drawcall
|
||||
_transform._invalidViewport = true;
|
||||
}
|
||||
|
||||
|
@ -86,9 +90,6 @@ void GLBackend::updateTransform() {
|
|||
// Check all the dirty flags and update the state accordingly
|
||||
if (_transform._invalidViewport) {
|
||||
_transform._transformCamera._viewport = glm::vec4(_transform._viewport);
|
||||
|
||||
// Where we assign the GL viewport
|
||||
glViewport(_transform._viewport.x, _transform._viewport.y, _transform._viewport.z, _transform._viewport.w);
|
||||
}
|
||||
|
||||
if (_transform._invalidProj) {
|
||||
|
|
|
@ -80,7 +80,7 @@ bool Texture::Storage::allocateMip(uint16 level) {
|
|||
auto& mip = _mips[level];
|
||||
for (auto& face : mip) {
|
||||
if (!face) {
|
||||
face.reset(new Pixels());
|
||||
face = std::make_shared<Pixels>();
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
@ -419,7 +419,7 @@ bool Texture::generateIrradiance() {
|
|||
return false;
|
||||
}
|
||||
if (!_irradiance) {
|
||||
_irradiance.reset(new SphericalHarmonics());
|
||||
_irradiance = std::make_shared<SphericalHarmonics>();
|
||||
}
|
||||
|
||||
_irradiance->evalFromTexture(*this);
|
||||
|
@ -563,7 +563,7 @@ glm::vec3 linearTosRGB(glm::vec3& color) {
|
|||
return glm::pow(color, glm::vec3(GAMMA_CORRECTION_INV));
|
||||
}
|
||||
|
||||
// Originial code for the Spherical Harmonics taken from "Sun and Black Cat- Igor Dykhta (igor dykhta email) © 2007-2014 "
|
||||
// Originial code for the Spherical Harmonics taken from "Sun and Black Cat- Igor Dykhta (igor dykhta email) <EFBFBD> 2007-2014 "
|
||||
void sphericalHarmonicsAdd(float * result, int order, const float * inputA, const float * inputB) {
|
||||
const int numCoeff = order * order;
|
||||
for(int i=0; i < numCoeff; i++) {
|
||||
|
|
|
@ -21,7 +21,7 @@ const unsigned int CONTROLLER_1_EVENT = 1501U;
|
|||
// instead of class Example : public InputDevice, public InputPlugin
|
||||
class InputDevice {
|
||||
public:
|
||||
InputDevice::InputDevice(const QString& name) : _name(name) {}
|
||||
InputDevice(const QString& name) : _name(name) {}
|
||||
|
||||
typedef std::unordered_set<int> ButtonPressedMap;
|
||||
typedef std::map<int, float> AxisStateMap;
|
||||
|
|
|
@ -102,7 +102,7 @@ void Joystick::registerToUserInputMapper(UserInputMapper& mapper) {
|
|||
// Grab the current free device ID
|
||||
_deviceID = mapper.getFreeDeviceID();
|
||||
|
||||
auto proxy = UserInputMapper::DeviceProxy::Pointer(new UserInputMapper::DeviceProxy(_name));
|
||||
auto proxy = std::make_shared<UserInputMapper::DeviceProxy>(_name);
|
||||
proxy->getButton = [this] (const UserInputMapper::Input& input, int timestamp) -> bool { return this->getButton(input.getChannel()); };
|
||||
proxy->getAxis = [this] (const UserInputMapper::Input& input, int timestamp) -> float { return this->getAxis(input.getChannel()); };
|
||||
proxy->getAvailabeInputs = [this] () -> QVector<UserInputMapper::InputPair> {
|
||||
|
|
2
libraries/input-plugins/src/input-plugins/KeyboardMouseDevice.cpp
Normal file → Executable file
2
libraries/input-plugins/src/input-plugins/KeyboardMouseDevice.cpp
Normal file → Executable file
|
@ -160,7 +160,7 @@ void KeyboardMouseDevice::registerToUserInputMapper(UserInputMapper& mapper) {
|
|||
// Grab the current free device ID
|
||||
_deviceID = mapper.getFreeDeviceID();
|
||||
|
||||
auto proxy = UserInputMapper::DeviceProxy::Pointer(new UserInputMapper::DeviceProxy(_name));
|
||||
auto proxy = std::make_shared<UserInputMapper::DeviceProxy>(_name);
|
||||
proxy->getButton = [this] (const UserInputMapper::Input& input, int timestamp) -> bool { return this->getButton(input.getChannel()); };
|
||||
proxy->getAxis = [this] (const UserInputMapper::Input& input, int timestamp) -> float { return this->getAxis(input.getChannel()); };
|
||||
proxy->getAvailabeInputs = [this] () -> QVector<UserInputMapper::InputPair> {
|
||||
|
|
|
@ -109,9 +109,9 @@ void SixenseManager::activate(PluginContainer* container) {
|
|||
}
|
||||
|
||||
if (_sixenseLibrary->load()){
|
||||
qCDebug(interfaceapp) << "Loaded sixense library for hydra support -" << _sixenseLibrary->fileName();
|
||||
qCDebug(inputplugins) << "Loaded sixense library for hydra support -" << _sixenseLibrary->fileName();
|
||||
} else {
|
||||
qCDebug(interfaceapp) << "Sixense library at" << _sixenseLibrary->fileName() << "failed to load."
|
||||
qCDebug(inputplugins) << "Sixense library at" << _sixenseLibrary->fileName() << "failed to load."
|
||||
<< "Continuing without hydra support.";
|
||||
return;
|
||||
}
|
||||
|
@ -451,7 +451,7 @@ void SixenseManager::registerToUserInputMapper(UserInputMapper& mapper) {
|
|||
// Grab the current free device ID
|
||||
_deviceID = mapper.getFreeDeviceID();
|
||||
|
||||
auto proxy = UserInputMapper::DeviceProxy::Pointer(new UserInputMapper::DeviceProxy(_name));
|
||||
auto proxy = std::make_shared<UserInputMapper::DeviceProxy>(_name);
|
||||
proxy->getButton = [this] (const UserInputMapper::Input& input, int timestamp) -> bool { return this->getButton(input.getChannel()); };
|
||||
proxy->getAxis = [this] (const UserInputMapper::Input& input, int timestamp) -> float { return this->getAxis(input.getChannel()); };
|
||||
proxy->getPose = [this](const UserInputMapper::Input& input, int timestamp) -> UserInputMapper::PoseValue { return this->getPose(input.getChannel()); };
|
||||
|
|
|
@ -22,10 +22,12 @@
|
|||
#include <plugins/PluginContainer.h>
|
||||
#include "UserActivityLogger.h"
|
||||
|
||||
#ifndef Q_OS_MAC
|
||||
extern vr::IVRSystem* _hmd;
|
||||
extern int hmdRefCount;
|
||||
extern vr::TrackedDevicePose_t _trackedDevicePose[vr::k_unMaxTrackedDeviceCount];
|
||||
extern mat4 _trackedDevicePoseMat4[vr::k_unMaxTrackedDeviceCount];
|
||||
#endif
|
||||
|
||||
const unsigned int LEFT_MASK = 0U;
|
||||
const unsigned int RIGHT_MASK = 1U;
|
||||
|
@ -62,10 +64,15 @@ ViveControllerManager::ViveControllerManager() :
|
|||
}
|
||||
|
||||
bool ViveControllerManager::isSupported() const {
|
||||
#ifndef Q_OS_MAC
|
||||
return vr::VR_IsHmdPresent();
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void ViveControllerManager::activate(PluginContainer* container) {
|
||||
#ifndef Q_OS_MAC
|
||||
container->addMenu(MENU_PATH);
|
||||
container->addMenuItem(MENU_PATH, RENDER_CONTROLLERS,
|
||||
[this, &container] (bool clicked) { this->setRenderControllers(clicked); },
|
||||
|
@ -125,9 +132,11 @@ void ViveControllerManager::activate(PluginContainer* container) {
|
|||
_modelLoaded = true;
|
||||
_renderControllers = true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void ViveControllerManager::deactivate(PluginContainer* container) {
|
||||
#ifndef Q_OS_MAC
|
||||
container->removeMenuItem(MENU_NAME, RENDER_CONTROLLERS);
|
||||
container->removeMenu(MENU_PATH);
|
||||
|
||||
|
@ -138,6 +147,7 @@ void ViveControllerManager::deactivate(PluginContainer* container) {
|
|||
_hmd = nullptr;
|
||||
}
|
||||
_poseStateMap.clear();
|
||||
#endif
|
||||
}
|
||||
|
||||
void ViveControllerManager::updateRendering(RenderArgs* args, render::ScenePointer scene, render::PendingChanges pendingChanges) {
|
||||
|
@ -203,18 +213,20 @@ void ViveControllerManager::renderHand(UserInputMapper::PoseValue pose, gpu::Bat
|
|||
}
|
||||
|
||||
void ViveControllerManager::update(float deltaTime, bool jointsCaptured) {
|
||||
#ifndef Q_OS_MAC
|
||||
_poseStateMap.clear();
|
||||
|
||||
// TODO: This shouldn't be necessary
|
||||
if (!_hmd) {
|
||||
return;
|
||||
}
|
||||
|
||||
_buttonPressedMap.clear();
|
||||
|
||||
|
||||
PerformanceTimer perfTimer("ViveControllerManager::update");
|
||||
|
||||
int numTrackedControllers = 0;
|
||||
|
||||
|
||||
for (vr::TrackedDeviceIndex_t device = vr::k_unTrackedDeviceIndex_Hmd + 1;
|
||||
device < vr::k_unMaxTrackedDeviceCount && numTrackedControllers < 2; ++device) {
|
||||
|
||||
|
@ -268,6 +280,7 @@ void ViveControllerManager::update(float deltaTime, bool jointsCaptured) {
|
|||
}
|
||||
|
||||
_trackedControllers = numTrackedControllers;
|
||||
#endif
|
||||
}
|
||||
|
||||
void ViveControllerManager::focusOutEvent() {
|
||||
|
|
|
@ -96,5 +96,4 @@ private:
|
|||
static const QString NAME;
|
||||
};
|
||||
|
||||
|
||||
#endif // hifi__ViveControllerManager
|
||||
|
|
|
@ -18,7 +18,7 @@ Light::Light() :
|
|||
_transform() {
|
||||
// only if created from nothing shall we create the Buffer to store the properties
|
||||
Schema schema;
|
||||
_schemaBuffer = gpu::BufferView(new gpu::Buffer(sizeof(Schema), (const gpu::Byte*) &schema));
|
||||
_schemaBuffer = gpu::BufferView(std::make_shared<gpu::Buffer>(sizeof(Schema), (const gpu::Byte*) &schema));
|
||||
}
|
||||
|
||||
Light::Light(const Light& light) :
|
||||
|
|
|
@ -20,7 +20,7 @@ Material::Material() :
|
|||
|
||||
// only if created from nothing shall we create the Buffer to store the properties
|
||||
Schema schema;
|
||||
_schemaBuffer = gpu::BufferView(new gpu::Buffer(sizeof(Schema), (const gpu::Byte*) &schema));
|
||||
_schemaBuffer = gpu::BufferView(std::make_shared<gpu::Buffer>(sizeof(Schema), (const gpu::Byte*) &schema));
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -68,19 +68,19 @@ void Skybox::render(gpu::Batch& batch, const ViewFrustum& viewFrustum, const Sky
|
|||
SKYBOX_CONSTANTS_SLOT = skyShader->getUniforms().findLocation("skyboxBuffer");
|
||||
}
|
||||
|
||||
auto skyState = gpu::StatePointer(new gpu::State());
|
||||
auto skyState = std::make_shared<gpu::State>();
|
||||
|
||||
thePipeline = gpu::PipelinePointer(gpu::Pipeline::create(skyShader, skyState));
|
||||
|
||||
const float CLIP = 1.0f;
|
||||
const glm::vec2 vertices[4] = { {-CLIP, -CLIP}, {CLIP, -CLIP}, {-CLIP, CLIP}, {CLIP, CLIP}};
|
||||
theBuffer.reset(new gpu::Buffer(sizeof(vertices), (const gpu::Byte*) vertices));
|
||||
theBuffer = std::make_shared<gpu::Buffer>(sizeof(vertices), (const gpu::Byte*) vertices);
|
||||
|
||||
theFormat.reset(new gpu::Stream::Format());
|
||||
theFormat = std::make_shared<gpu::Stream::Format>();
|
||||
theFormat->setAttribute(gpu::Stream::POSITION, gpu::Stream::POSITION, gpu::Element(gpu::VEC2, gpu::FLOAT, gpu::XYZ));
|
||||
|
||||
auto color = glm::vec4(1.0f);
|
||||
theConstants.reset(new gpu::Buffer(sizeof(color), (const gpu::Byte*) &color));
|
||||
theConstants = std::make_shared<gpu::Buffer>(sizeof(color), (const gpu::Byte*) &color);
|
||||
}
|
||||
|
||||
glm::mat4 projMat;
|
||||
|
|
|
@ -136,7 +136,7 @@ void EarthSunModel::setSunLongitude(float lon) {
|
|||
Atmosphere::Atmosphere() {
|
||||
// only if created from nothing shall we create the Buffer to store the properties
|
||||
Data data;
|
||||
_dataBuffer = gpu::BufferView(new gpu::Buffer(sizeof(Data), (const gpu::Byte*) &data));
|
||||
_dataBuffer = gpu::BufferView(std::make_shared<gpu::Buffer>(sizeof(Data), (const gpu::Byte*) &data));
|
||||
|
||||
setScatteringWavelength(_scatteringWavelength);
|
||||
setRayleighScattering(_rayleighScattering);
|
||||
|
@ -188,8 +188,8 @@ const float NUM_HOURS_PER_DAY = 24.0f;
|
|||
const float NUM_HOURS_PER_HALF_DAY = NUM_HOURS_PER_DAY * 0.5f;
|
||||
|
||||
SunSkyStage::SunSkyStage() :
|
||||
_sunLight(new Light()),
|
||||
_skybox(new Skybox())
|
||||
_sunLight(std::make_shared<Light>()),
|
||||
_skybox(std::make_shared<Skybox>())
|
||||
{
|
||||
_sunLight->setType(Light::SUN);
|
||||
|
||||
|
@ -204,9 +204,8 @@ SunSkyStage::SunSkyStage() :
|
|||
// Begining of march
|
||||
setYearTime(60.0f);
|
||||
|
||||
_skybox.reset(new Skybox());
|
||||
_skybox = std::make_shared<Skybox>();
|
||||
_skybox->setColor(Color(1.0f, 0.0f, 0.0f));
|
||||
|
||||
}
|
||||
|
||||
SunSkyStage::~SunSkyStage() {
|
||||
|
@ -302,4 +301,4 @@ void SunSkyStage::setBackgroundMode(BackgroundMode mode) {
|
|||
void SunSkyStage::setSkybox(const SkyboxPointer& skybox) {
|
||||
_skybox = skybox;
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -215,7 +215,7 @@ static QHash<QUuid, BandwidthRecorderPtr> PEER_BANDWIDTH;
|
|||
|
||||
BandwidthRecorder& getBandwidthRecorder(const QUuid & uuid) {
|
||||
if (!PEER_BANDWIDTH.count(uuid)) {
|
||||
PEER_BANDWIDTH.insert(uuid, BandwidthRecorderPtr(new BandwidthRecorder()));
|
||||
PEER_BANDWIDTH.insert(uuid, QSharedPointer<BandwidthRecorder>::create());
|
||||
}
|
||||
return *PEER_BANDWIDTH[uuid].data();
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ public:
|
|||
virtual bool getCascadeShadowsEnabled() = 0;
|
||||
|
||||
virtual QThread* getMainThread() = 0;
|
||||
virtual const Transform& getViewTransform() const = 0;
|
||||
|
||||
virtual bool shouldRenderMesh(float largestDimension, float distanceToCamera) = 0;
|
||||
virtual float getSizeScale() const = 0;
|
||||
virtual int getBoundaryLevelAdjust() const = 0;
|
||||
|
|
|
@ -56,7 +56,7 @@ gpu::PipelinePointer DeferredLightingEffect::getPipeline(SimpleProgramKey config
|
|||
return it.value();
|
||||
}
|
||||
|
||||
gpu::StatePointer state = gpu::StatePointer(new gpu::State());
|
||||
auto state = std::make_shared<gpu::State>();
|
||||
if (config.isCulled()) {
|
||||
state->setCullMode(gpu::State::CULL_BACK);
|
||||
} else {
|
||||
|
@ -117,7 +117,7 @@ void DeferredLightingEffect::init(AbstractViewStateInterface* viewState) {
|
|||
//auto PSBlit = gpu::StandardShaderLib::getDrawTexturePS();
|
||||
auto blitProgram = gpu::StandardShaderLib::getProgram(gpu::StandardShaderLib::getDrawViewportQuadTransformTexcoordVS, gpu::StandardShaderLib::getDrawTexturePS);
|
||||
gpu::Shader::makeProgram(*blitProgram);
|
||||
gpu::StatePointer blitState = gpu::StatePointer(new gpu::State());
|
||||
auto blitState = std::make_shared<gpu::State>();
|
||||
blitState->setBlendFunction(true,
|
||||
gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA,
|
||||
gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE);
|
||||
|
@ -127,7 +127,7 @@ void DeferredLightingEffect::init(AbstractViewStateInterface* viewState) {
|
|||
|
||||
// Allocate a global light representing the Global Directional light casting shadow (the sun) and the ambient light
|
||||
_globalLights.push_back(0);
|
||||
_allocatedLights.push_back(model::LightPointer(new model::Light()));
|
||||
_allocatedLights.push_back(std::make_shared<model::Light>());
|
||||
|
||||
model::LightPointer lp = _allocatedLights[0];
|
||||
|
||||
|
@ -191,7 +191,7 @@ void DeferredLightingEffect::addSpotLight(const glm::vec3& position, float radiu
|
|||
|
||||
unsigned int lightID = _pointLights.size() + _spotLights.size() + _globalLights.size();
|
||||
if (lightID >= _allocatedLights.size()) {
|
||||
_allocatedLights.push_back(model::LightPointer(new model::Light()));
|
||||
_allocatedLights.push_back(std::make_shared<model::Light>());
|
||||
}
|
||||
model::LightPointer lp = _allocatedLights[lightID];
|
||||
|
||||
|
@ -614,7 +614,7 @@ void DeferredLightingEffect::loadLightProgram(const char* vertSource, const char
|
|||
locations.atmosphereBufferUnit = program->getUniforms().findLocation("atmosphereBufferUnit");
|
||||
#endif
|
||||
|
||||
gpu::StatePointer state = gpu::StatePointer(new gpu::State());
|
||||
auto state = std::make_shared<gpu::State>();
|
||||
if (lightVolume) {
|
||||
state->setCullMode(gpu::State::CULL_BACK);
|
||||
|
||||
|
@ -657,7 +657,7 @@ void DeferredLightingEffect::setGlobalSkybox(const model::SkyboxPointer& skybox)
|
|||
|
||||
model::MeshPointer DeferredLightingEffect::getSpotLightMesh() {
|
||||
if (!_spotLightMesh) {
|
||||
_spotLightMesh.reset(new model::Mesh());
|
||||
_spotLightMesh = std::make_shared<model::Mesh>();
|
||||
|
||||
int slices = 32;
|
||||
int rings = 3;
|
||||
|
|
|
@ -59,7 +59,7 @@ void Environment::setupAtmosphereProgram(const char* vertSource, const char* fra
|
|||
gpu::Shader::BindingSet slotBindings;
|
||||
gpu::Shader::makeProgram(*program, slotBindings);
|
||||
|
||||
gpu::StatePointer state = gpu::StatePointer(new gpu::State());
|
||||
auto state = std::make_shared<gpu::State>();
|
||||
|
||||
state->setCullMode(gpu::State::CULL_NONE);
|
||||
state->setDepthTest(false);
|
||||
|
|
|
@ -79,8 +79,8 @@ void GeometryCache::renderSphere(gpu::Batch& batch, float radius, int slices, in
|
|||
qCDebug(renderutils) << "renderSphere()... RELEASING REGISTERED VERTICES BUFFER";
|
||||
#endif
|
||||
}
|
||||
|
||||
gpu::BufferPointer verticesBuffer(new gpu::Buffer());
|
||||
|
||||
auto verticesBuffer = std::make_shared<gpu::Buffer>();
|
||||
if (registered) {
|
||||
_registeredSphereVertices[id] = verticesBuffer;
|
||||
_lastRegisteredSphereVertices[id] = radiusKey;
|
||||
|
@ -144,7 +144,7 @@ void GeometryCache::renderSphere(gpu::Batch& batch, float radius, int slices, in
|
|||
#endif
|
||||
}
|
||||
|
||||
gpu::BufferPointer indicesBuffer(new gpu::Buffer());
|
||||
auto indicesBuffer = std::make_shared<gpu::Buffer>();
|
||||
if (registered) {
|
||||
_registeredSphereIndices[id] = indicesBuffer;
|
||||
_lastRegisteredSphereIndices[id] = slicesStacksKey;
|
||||
|
@ -229,8 +229,8 @@ void GeometryCache::renderSphere(gpu::Batch& batch, float radius, int slices, in
|
|||
qCDebug(renderutils) << "renderSphere()... RELEASING REGISTERED COLORS BUFFER";
|
||||
#endif
|
||||
}
|
||||
|
||||
gpu::BufferPointer colorBuffer(new gpu::Buffer());
|
||||
|
||||
auto colorBuffer = std::make_shared<gpu::Buffer>();
|
||||
if (registered) {
|
||||
_registeredSphereColors[id] = colorBuffer;
|
||||
_lastRegisteredSphereColors[id] = colorKey;
|
||||
|
@ -278,7 +278,7 @@ void GeometryCache::renderSphere(gpu::Batch& batch, float radius, int slices, in
|
|||
static gpu::Stream::FormatPointer streamFormat;
|
||||
static gpu::Element positionElement, normalElement, colorElement;
|
||||
if (!streamFormat) {
|
||||
streamFormat.reset(new gpu::Stream::Format()); // 1 for everyone
|
||||
streamFormat = std::make_shared<gpu::Stream::Format>(); // 1 for everyone
|
||||
streamFormat->setAttribute(gpu::Stream::POSITION, VERTICES_SLOT, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ), 0);
|
||||
streamFormat->setAttribute(gpu::Stream::NORMAL, NORMALS_SLOT, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ));
|
||||
streamFormat->setAttribute(gpu::Stream::COLOR, COLOR_SLOT, gpu::Element(gpu::VEC4, gpu::UINT8, gpu::RGBA));
|
||||
|
@ -316,7 +316,7 @@ void GeometryCache::renderGrid(gpu::Batch& batch, int xDivisions, int yDivisions
|
|||
|
||||
int vertices = (xDivisions + 1 + yDivisions + 1) * 2;
|
||||
if (!_gridBuffers.contains(key)) {
|
||||
gpu::BufferPointer verticesBuffer(new gpu::Buffer());
|
||||
auto verticesBuffer = std::make_shared<gpu::Buffer>();
|
||||
|
||||
GLfloat* vertexData = new GLfloat[vertices * 2];
|
||||
GLfloat* vertex = vertexData;
|
||||
|
@ -347,7 +347,7 @@ void GeometryCache::renderGrid(gpu::Batch& batch, int xDivisions, int yDivisions
|
|||
}
|
||||
|
||||
if (!_gridColors.contains(colorKey)) {
|
||||
gpu::BufferPointer colorBuffer(new gpu::Buffer());
|
||||
auto colorBuffer = std::make_shared<gpu::Buffer>();
|
||||
_gridColors[colorKey] = colorBuffer;
|
||||
|
||||
int compactColor = ((int(color.x * 255.0f) & 0xFF)) |
|
||||
|
@ -370,7 +370,7 @@ void GeometryCache::renderGrid(gpu::Batch& batch, int xDivisions, int yDivisions
|
|||
|
||||
const int VERTICES_SLOT = 0;
|
||||
const int COLOR_SLOT = 1;
|
||||
gpu::Stream::FormatPointer streamFormat(new gpu::Stream::Format()); // 1 for everyone
|
||||
auto streamFormat = std::make_shared<gpu::Stream::Format>(); // 1 for everyone
|
||||
|
||||
streamFormat->setAttribute(gpu::Stream::POSITION, VERTICES_SLOT, gpu::Element(gpu::VEC2, gpu::FLOAT, gpu::XYZ), 0);
|
||||
streamFormat->setAttribute(gpu::Stream::COLOR, COLOR_SLOT, gpu::Element(gpu::VEC4, gpu::UINT8, gpu::RGBA));
|
||||
|
@ -417,7 +417,7 @@ void GeometryCache::renderGrid(gpu::Batch& batch, int x, int y, int width, int h
|
|||
#endif
|
||||
}
|
||||
|
||||
gpu::BufferPointer verticesBuffer(new gpu::Buffer());
|
||||
auto verticesBuffer = std::make_shared<gpu::Buffer>();
|
||||
if (registered) {
|
||||
_registeredAlternateGridBuffers[id] = verticesBuffer;
|
||||
_lastRegisteredAlternateGridBuffers[id] = key;
|
||||
|
@ -445,8 +445,6 @@ void GeometryCache::renderGrid(gpu::Batch& batch, int x, int y, int width, int h
|
|||
}
|
||||
// Draw vertical grid lines
|
||||
for (int i = cols + 1; --i >= 0; ) {
|
||||
//glVertex2i(tx, y);
|
||||
//glVertex2i(tx, y + height);
|
||||
*(vertex++) = tx;
|
||||
*(vertex++) = y;
|
||||
|
||||
|
@ -460,7 +458,7 @@ void GeometryCache::renderGrid(gpu::Batch& batch, int x, int y, int width, int h
|
|||
}
|
||||
|
||||
if (!_gridColors.contains(colorKey)) {
|
||||
gpu::BufferPointer colorBuffer(new gpu::Buffer());
|
||||
auto colorBuffer = std::make_shared<gpu::Buffer>();
|
||||
_gridColors[colorKey] = colorBuffer;
|
||||
|
||||
int compactColor = ((int(color.x * 255.0f) & 0xFF)) |
|
||||
|
@ -485,7 +483,7 @@ void GeometryCache::renderGrid(gpu::Batch& batch, int x, int y, int width, int h
|
|||
|
||||
const int VERTICES_SLOT = 0;
|
||||
const int COLOR_SLOT = 1;
|
||||
gpu::Stream::FormatPointer streamFormat(new gpu::Stream::Format()); // 1 for everyone
|
||||
auto streamFormat = std::make_shared<gpu::Stream::Format>(); // 1 for everyone
|
||||
|
||||
streamFormat->setAttribute(gpu::Stream::POSITION, VERTICES_SLOT, gpu::Element(gpu::VEC2, gpu::FLOAT, gpu::XYZ), 0);
|
||||
streamFormat->setAttribute(gpu::Stream::COLOR, COLOR_SLOT, gpu::Element(gpu::VEC4, gpu::UINT8, gpu::RGBA));
|
||||
|
@ -513,11 +511,11 @@ void GeometryCache::updateVertices(int id, const QVector<glm::vec2>& points, con
|
|||
details.isCreated = true;
|
||||
details.vertices = points.size();
|
||||
details.vertexSize = FLOATS_PER_VERTEX;
|
||||
|
||||
gpu::BufferPointer verticesBuffer(new gpu::Buffer());
|
||||
gpu::BufferPointer colorBuffer(new gpu::Buffer());
|
||||
gpu::Stream::FormatPointer streamFormat(new gpu::Stream::Format());
|
||||
gpu::BufferStreamPointer stream(new gpu::BufferStream());
|
||||
|
||||
auto verticesBuffer = std::make_shared<gpu::Buffer>();
|
||||
auto colorBuffer = std::make_shared<gpu::Buffer>();
|
||||
auto streamFormat = std::make_shared<gpu::Stream::Format>();
|
||||
auto stream = std::make_shared<gpu::BufferStream>();
|
||||
|
||||
details.verticesBuffer = verticesBuffer;
|
||||
details.colorBuffer = colorBuffer;
|
||||
|
@ -574,11 +572,11 @@ void GeometryCache::updateVertices(int id, const QVector<glm::vec3>& points, con
|
|||
details.isCreated = true;
|
||||
details.vertices = points.size();
|
||||
details.vertexSize = FLOATS_PER_VERTEX;
|
||||
|
||||
gpu::BufferPointer verticesBuffer(new gpu::Buffer());
|
||||
gpu::BufferPointer colorBuffer(new gpu::Buffer());
|
||||
gpu::Stream::FormatPointer streamFormat(new gpu::Stream::Format());
|
||||
gpu::BufferStreamPointer stream(new gpu::BufferStream());
|
||||
|
||||
auto verticesBuffer = std::make_shared<gpu::Buffer>();
|
||||
auto colorBuffer = std::make_shared<gpu::Buffer>();
|
||||
auto streamFormat = std::make_shared<gpu::Stream::Format>();
|
||||
auto stream = std::make_shared<gpu::BufferStream>();
|
||||
|
||||
details.verticesBuffer = verticesBuffer;
|
||||
details.colorBuffer = colorBuffer;
|
||||
|
@ -637,11 +635,11 @@ void GeometryCache::updateVertices(int id, const QVector<glm::vec3>& points, con
|
|||
details.isCreated = true;
|
||||
details.vertices = points.size();
|
||||
details.vertexSize = FLOATS_PER_VERTEX;
|
||||
|
||||
gpu::BufferPointer verticesBuffer(new gpu::Buffer());
|
||||
gpu::BufferPointer colorBuffer(new gpu::Buffer());
|
||||
gpu::Stream::FormatPointer streamFormat(new gpu::Stream::Format());
|
||||
gpu::BufferStreamPointer stream(new gpu::BufferStream());
|
||||
|
||||
auto verticesBuffer = std::make_shared<gpu::Buffer>();
|
||||
auto colorBuffer = std::make_shared<gpu::Buffer>();
|
||||
auto streamFormat = std::make_shared<gpu::Stream::Format>();
|
||||
auto stream = std::make_shared<gpu::BufferStream>();
|
||||
|
||||
details.verticesBuffer = verticesBuffer;
|
||||
details.colorBuffer = colorBuffer;
|
||||
|
@ -728,7 +726,7 @@ void GeometryCache::renderSolidCube(gpu::Batch& batch, float size, const glm::ve
|
|||
const int NORMALS_OFFSET = sizeof(GLfloat) * FLOATS_PER_VERTEX;
|
||||
|
||||
if (!_solidCubeVertices.contains(size)) {
|
||||
gpu::BufferPointer verticesBuffer(new gpu::Buffer());
|
||||
auto verticesBuffer = std::make_shared<gpu::Buffer>();
|
||||
_solidCubeVertices[size] = verticesBuffer;
|
||||
|
||||
GLfloat* vertexData = new GLfloat[vertexPoints * 2]; // vertices and normals
|
||||
|
@ -779,15 +777,15 @@ void GeometryCache::renderSolidCube(gpu::Batch& batch, float size, const glm::ve
|
|||
12,13,14, 14,15,12, // left
|
||||
16,17,18, 18,19,16, // bottom
|
||||
20,21,22, 22,23,20 }; // back
|
||||
|
||||
gpu::BufferPointer indexBuffer(new gpu::Buffer());
|
||||
|
||||
auto indexBuffer = std::make_shared<gpu::Buffer>();
|
||||
_solidCubeIndexBuffer = indexBuffer;
|
||||
|
||||
_solidCubeIndexBuffer->append(sizeof(cannonicalIndices), (gpu::Byte*) cannonicalIndices);
|
||||
}
|
||||
|
||||
if (!_solidCubeColors.contains(colorKey)) {
|
||||
gpu::BufferPointer colorBuffer(new gpu::Buffer());
|
||||
auto colorBuffer = std::make_shared<gpu::Buffer>();
|
||||
_solidCubeColors[colorKey] = colorBuffer;
|
||||
|
||||
const int NUM_COLOR_SCALARS_PER_CUBE = 24;
|
||||
|
@ -813,7 +811,7 @@ void GeometryCache::renderSolidCube(gpu::Batch& batch, float size, const glm::ve
|
|||
static gpu::Stream::FormatPointer streamFormat;
|
||||
static gpu::Element positionElement, normalElement, colorElement;
|
||||
if (!streamFormat) {
|
||||
streamFormat.reset(new gpu::Stream::Format()); // 1 for everyone
|
||||
streamFormat = std::make_shared<gpu::Stream::Format>(); // 1 for everyone
|
||||
streamFormat->setAttribute(gpu::Stream::POSITION, VERTICES_SLOT, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ), 0);
|
||||
streamFormat->setAttribute(gpu::Stream::NORMAL, NORMALS_SLOT, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ));
|
||||
streamFormat->setAttribute(gpu::Stream::COLOR, COLOR_SLOT, gpu::Element(gpu::VEC4, gpu::UINT8, gpu::RGBA));
|
||||
|
@ -852,7 +850,7 @@ void GeometryCache::renderWireCube(gpu::Batch& batch, float size, const glm::vec
|
|||
const int indices = (TOP_EDGES + BOTTOM_EDGES + SIDE_EDGES) * VERTICES_PER_EDGE;
|
||||
|
||||
if (!_cubeVerticies.contains(size)) {
|
||||
gpu::BufferPointer verticesBuffer(new gpu::Buffer());
|
||||
auto verticesBuffer = std::make_shared<gpu::Buffer>();
|
||||
_cubeVerticies[size] = verticesBuffer;
|
||||
|
||||
int vertexPoints = vertices * FLOATS_PER_VERTEX;
|
||||
|
@ -878,15 +876,15 @@ void GeometryCache::renderWireCube(gpu::Batch& batch, float size, const glm::vec
|
|||
4, 5, 5, 6, 6, 7, 7, 4, // (bottom)
|
||||
0, 4, 1, 5, 2, 6, 3, 7, // (side edges)
|
||||
};
|
||||
|
||||
gpu::BufferPointer indexBuffer(new gpu::Buffer());
|
||||
|
||||
auto indexBuffer = std::make_shared<gpu::Buffer>();
|
||||
_wireCubeIndexBuffer = indexBuffer;
|
||||
|
||||
_wireCubeIndexBuffer->append(sizeof(cannonicalIndices), (gpu::Byte*) cannonicalIndices);
|
||||
}
|
||||
|
||||
if (!_cubeColors.contains(colorKey)) {
|
||||
gpu::BufferPointer colorBuffer(new gpu::Buffer());
|
||||
auto colorBuffer = std::make_shared<gpu::Buffer>();
|
||||
_cubeColors[colorKey] = colorBuffer;
|
||||
|
||||
const int NUM_COLOR_SCALARS_PER_CUBE = 8;
|
||||
|
@ -907,7 +905,7 @@ void GeometryCache::renderWireCube(gpu::Batch& batch, float size, const glm::vec
|
|||
static gpu::Stream::FormatPointer streamFormat;
|
||||
static gpu::Element positionElement, colorElement;
|
||||
if (!streamFormat) {
|
||||
streamFormat.reset(new gpu::Stream::Format()); // 1 for everyone
|
||||
streamFormat = std::make_shared<gpu::Stream::Format>(); // 1 for everyone
|
||||
streamFormat->setAttribute(gpu::Stream::POSITION, VERTICES_SLOT, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ), 0);
|
||||
streamFormat->setAttribute(gpu::Stream::COLOR, COLOR_SLOT, gpu::Element(gpu::VEC4, gpu::UINT8, gpu::RGBA));
|
||||
positionElement = streamFormat->getAttributes().at(gpu::Stream::POSITION)._element;
|
||||
|
@ -959,11 +957,11 @@ void GeometryCache::renderBevelCornersRect(gpu::Batch& batch, int x, int y, int
|
|||
details.isCreated = true;
|
||||
details.vertices = NUM_VERTICES;
|
||||
details.vertexSize = FLOATS_PER_VERTEX;
|
||||
|
||||
gpu::BufferPointer verticesBuffer(new gpu::Buffer());
|
||||
gpu::BufferPointer colorBuffer(new gpu::Buffer());
|
||||
gpu::Stream::FormatPointer streamFormat(new gpu::Stream::Format());
|
||||
gpu::BufferStreamPointer stream(new gpu::BufferStream());
|
||||
|
||||
auto verticesBuffer = std::make_shared<gpu::Buffer>();
|
||||
auto colorBuffer = std::make_shared<gpu::Buffer>();
|
||||
auto streamFormat = std::make_shared<gpu::Stream::Format>();
|
||||
auto stream = std::make_shared<gpu::BufferStream>();
|
||||
|
||||
details.verticesBuffer = verticesBuffer;
|
||||
details.colorBuffer = colorBuffer;
|
||||
|
@ -1067,11 +1065,11 @@ void GeometryCache::renderQuad(gpu::Batch& batch, const glm::vec2& minCorner, co
|
|||
details.isCreated = true;
|
||||
details.vertices = vertices;
|
||||
details.vertexSize = FLOATS_PER_VERTEX;
|
||||
|
||||
gpu::BufferPointer verticesBuffer(new gpu::Buffer());
|
||||
gpu::BufferPointer colorBuffer(new gpu::Buffer());
|
||||
gpu::Stream::FormatPointer streamFormat(new gpu::Stream::Format());
|
||||
gpu::BufferStreamPointer stream(new gpu::BufferStream());
|
||||
|
||||
auto verticesBuffer = std::make_shared<gpu::Buffer>();
|
||||
auto colorBuffer = std::make_shared<gpu::Buffer>();
|
||||
auto streamFormat = std::make_shared<gpu::Stream::Format>();
|
||||
auto stream = std::make_shared<gpu::BufferStream>();
|
||||
|
||||
details.verticesBuffer = verticesBuffer;
|
||||
details.colorBuffer = colorBuffer;
|
||||
|
@ -1173,11 +1171,11 @@ void GeometryCache::renderQuad(gpu::Batch& batch, const glm::vec2& minCorner, co
|
|||
details.isCreated = true;
|
||||
details.vertices = vertices;
|
||||
details.vertexSize = FLOATS_PER_VERTEX;
|
||||
|
||||
gpu::BufferPointer verticesBuffer(new gpu::Buffer());
|
||||
gpu::BufferPointer colorBuffer(new gpu::Buffer());
|
||||
gpu::Stream::FormatPointer streamFormat(new gpu::Stream::Format());
|
||||
gpu::BufferStreamPointer stream(new gpu::BufferStream());
|
||||
|
||||
auto verticesBuffer = std::make_shared<gpu::Buffer>();
|
||||
auto colorBuffer = std::make_shared<gpu::Buffer>();
|
||||
auto streamFormat = std::make_shared<gpu::Stream::Format>();
|
||||
auto stream = std::make_shared<gpu::BufferStream>();
|
||||
|
||||
details.verticesBuffer = verticesBuffer;
|
||||
details.colorBuffer = colorBuffer;
|
||||
|
@ -1252,11 +1250,11 @@ void GeometryCache::renderQuad(gpu::Batch& batch, const glm::vec3& minCorner, co
|
|||
details.isCreated = true;
|
||||
details.vertices = vertices;
|
||||
details.vertexSize = FLOATS_PER_VERTEX;
|
||||
|
||||
gpu::BufferPointer verticesBuffer(new gpu::Buffer());
|
||||
gpu::BufferPointer colorBuffer(new gpu::Buffer());
|
||||
gpu::Stream::FormatPointer streamFormat(new gpu::Stream::Format());
|
||||
gpu::BufferStreamPointer stream(new gpu::BufferStream());
|
||||
|
||||
auto verticesBuffer = std::make_shared<gpu::Buffer>();
|
||||
auto colorBuffer = std::make_shared<gpu::Buffer>();
|
||||
auto streamFormat = std::make_shared<gpu::Stream::Format>();
|
||||
auto stream = std::make_shared<gpu::BufferStream>();
|
||||
|
||||
details.verticesBuffer = verticesBuffer;
|
||||
details.colorBuffer = colorBuffer;
|
||||
|
@ -1355,11 +1353,11 @@ void GeometryCache::renderQuad(gpu::Batch& batch, const glm::vec3& topLeft, cons
|
|||
details.isCreated = true;
|
||||
details.vertices = vertices;
|
||||
details.vertexSize = FLOATS_PER_VERTEX; // NOTE: this isn't used for BatchItemDetails maybe we can get rid of it
|
||||
|
||||
gpu::BufferPointer verticesBuffer(new gpu::Buffer());
|
||||
gpu::BufferPointer colorBuffer(new gpu::Buffer());
|
||||
gpu::Stream::FormatPointer streamFormat(new gpu::Stream::Format());
|
||||
gpu::BufferStreamPointer stream(new gpu::BufferStream());
|
||||
|
||||
auto verticesBuffer = std::make_shared<gpu::Buffer>();
|
||||
auto colorBuffer = std::make_shared<gpu::Buffer>();
|
||||
auto streamFormat = std::make_shared<gpu::Stream::Format>();
|
||||
auto stream = std::make_shared<gpu::BufferStream>();
|
||||
|
||||
details.verticesBuffer = verticesBuffer;
|
||||
details.colorBuffer = colorBuffer;
|
||||
|
@ -1442,11 +1440,11 @@ void GeometryCache::renderDashedLine(gpu::Batch& batch, const glm::vec3& start,
|
|||
details.vertices = (segmentCountFloor + 1) * 2;
|
||||
details.vertexSize = FLOATS_PER_VERTEX;
|
||||
details.isCreated = true;
|
||||
|
||||
gpu::BufferPointer verticesBuffer(new gpu::Buffer());
|
||||
gpu::BufferPointer colorBuffer(new gpu::Buffer());
|
||||
gpu::Stream::FormatPointer streamFormat(new gpu::Stream::Format());
|
||||
gpu::BufferStreamPointer stream(new gpu::BufferStream());
|
||||
|
||||
auto verticesBuffer = std::make_shared<gpu::Buffer>();
|
||||
auto colorBuffer = std::make_shared<gpu::Buffer>();
|
||||
auto streamFormat = std::make_shared<gpu::Stream::Format>();
|
||||
auto stream = std::make_shared<gpu::BufferStream>();
|
||||
|
||||
details.verticesBuffer = verticesBuffer;
|
||||
details.colorBuffer = colorBuffer;
|
||||
|
@ -1607,11 +1605,11 @@ void GeometryCache::renderLine(gpu::Batch& batch, const glm::vec3& p1, const glm
|
|||
details.isCreated = true;
|
||||
details.vertices = vertices;
|
||||
details.vertexSize = FLOATS_PER_VERTEX;
|
||||
|
||||
gpu::BufferPointer verticesBuffer(new gpu::Buffer());
|
||||
gpu::BufferPointer colorBuffer(new gpu::Buffer());
|
||||
gpu::Stream::FormatPointer streamFormat(new gpu::Stream::Format());
|
||||
gpu::BufferStreamPointer stream(new gpu::BufferStream());
|
||||
|
||||
auto verticesBuffer = std::make_shared<gpu::Buffer>();
|
||||
auto colorBuffer = std::make_shared<gpu::Buffer>();
|
||||
auto streamFormat = std::make_shared<gpu::Stream::Format>();
|
||||
auto stream = std::make_shared<gpu::BufferStream>();
|
||||
|
||||
details.verticesBuffer = verticesBuffer;
|
||||
details.colorBuffer = colorBuffer;
|
||||
|
@ -1697,11 +1695,11 @@ void GeometryCache::renderLine(gpu::Batch& batch, const glm::vec2& p1, const glm
|
|||
details.isCreated = true;
|
||||
details.vertices = vertices;
|
||||
details.vertexSize = FLOATS_PER_VERTEX;
|
||||
|
||||
gpu::BufferPointer verticesBuffer(new gpu::Buffer());
|
||||
gpu::BufferPointer colorBuffer(new gpu::Buffer());
|
||||
gpu::Stream::FormatPointer streamFormat(new gpu::Stream::Format());
|
||||
gpu::BufferStreamPointer stream(new gpu::BufferStream());
|
||||
|
||||
auto verticesBuffer = std::make_shared<gpu::Buffer>();
|
||||
auto colorBuffer = std::make_shared<gpu::Buffer>();
|
||||
auto streamFormat = std::make_shared<gpu::Stream::Format>();
|
||||
auto stream = std::make_shared<gpu::BufferStream>();
|
||||
|
||||
details.verticesBuffer = verticesBuffer;
|
||||
details.colorBuffer = colorBuffer;
|
||||
|
@ -1758,7 +1756,7 @@ void GeometryCache::useSimpleDrawPipeline(gpu::Batch& batch) {
|
|||
auto program = gpu::ShaderPointer(gpu::Shader::createProgram(vs, ps));
|
||||
gpu::Shader::makeProgram((*program));
|
||||
|
||||
auto state = gpu::StatePointer(new gpu::State());
|
||||
auto state = std::make_shared<gpu::State>();
|
||||
|
||||
// enable decal blend
|
||||
state->setBlendFunction(true, gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA);
|
||||
|
@ -2131,8 +2129,8 @@ void NetworkGeometry::downloadFinished(QNetworkReply* reply) {
|
|||
}
|
||||
QVariantHash lods = _mapping.value("lod").toHash();
|
||||
for (QVariantHash::const_iterator it = lods.begin(); it != lods.end(); it++) {
|
||||
QSharedPointer<NetworkGeometry> geometry(new NetworkGeometry(url.resolved(it.key()),
|
||||
QSharedPointer<NetworkGeometry>(), true, _mapping, _textureBase));
|
||||
auto geometry = QSharedPointer<NetworkGeometry>::create(url.resolved(it.key()),
|
||||
QSharedPointer<NetworkGeometry>(), true, _mapping, _textureBase);
|
||||
geometry->setSelf(geometry.staticCast<Resource>());
|
||||
geometry->setLODParent(_lodParent);
|
||||
_lods.insert(it.value().toFloat(), geometry);
|
||||
|
@ -2208,7 +2206,7 @@ void NetworkGeometry::setGeometry(const FBXGeometry& geometry) {
|
|||
}
|
||||
|
||||
{
|
||||
networkMesh._indexBuffer = gpu::BufferPointer(new gpu::Buffer());
|
||||
networkMesh._indexBuffer = std::make_shared<gpu::Buffer>();
|
||||
networkMesh._indexBuffer->resize(totalIndices * sizeof(int));
|
||||
int offset = 0;
|
||||
foreach(const FBXMeshPart& part, mesh.parts) {
|
||||
|
@ -2222,7 +2220,7 @@ void NetworkGeometry::setGeometry(const FBXGeometry& geometry) {
|
|||
}
|
||||
|
||||
{
|
||||
networkMesh._vertexBuffer = gpu::BufferPointer(new gpu::Buffer());
|
||||
networkMesh._vertexBuffer = std::make_shared<gpu::Buffer>();
|
||||
// if we don't need to do any blending, the positions/normals can be static
|
||||
if (mesh.blendshapes.isEmpty()) {
|
||||
int normalsOffset = mesh.vertices.size() * sizeof(glm::vec3);
|
||||
|
@ -2250,7 +2248,7 @@ void NetworkGeometry::setGeometry(const FBXGeometry& geometry) {
|
|||
mesh.clusterWeights.size() * sizeof(glm::vec4), (gpu::Byte*) mesh.clusterWeights.constData());
|
||||
|
||||
// otherwise, at least the cluster indices/weights can be static
|
||||
networkMesh._vertexStream = gpu::BufferStreamPointer(new gpu::BufferStream());
|
||||
networkMesh._vertexStream = std::make_shared<gpu::BufferStream>();
|
||||
networkMesh._vertexStream->addBuffer(networkMesh._vertexBuffer, 0, sizeof(glm::vec3));
|
||||
if (mesh.normals.size()) networkMesh._vertexStream->addBuffer(networkMesh._vertexBuffer, normalsOffset, sizeof(glm::vec3));
|
||||
if (mesh.tangents.size()) networkMesh._vertexStream->addBuffer(networkMesh._vertexBuffer, tangentsOffset, sizeof(glm::vec3));
|
||||
|
@ -2261,7 +2259,7 @@ void NetworkGeometry::setGeometry(const FBXGeometry& geometry) {
|
|||
if (mesh.clusterWeights.size()) networkMesh._vertexStream->addBuffer(networkMesh._vertexBuffer, clusterWeightsOffset, sizeof(glm::vec4));
|
||||
|
||||
int channelNum = 0;
|
||||
networkMesh._vertexFormat = gpu::Stream::FormatPointer(new gpu::Stream::Format());
|
||||
networkMesh._vertexFormat = std::make_shared<gpu::Stream::Format>();
|
||||
networkMesh._vertexFormat->setAttribute(gpu::Stream::POSITION, channelNum++, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ), 0);
|
||||
if (mesh.normals.size()) networkMesh._vertexFormat->setAttribute(gpu::Stream::NORMAL, channelNum++, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ));
|
||||
if (mesh.tangents.size()) networkMesh._vertexFormat->setAttribute(gpu::Stream::TANGENT, channelNum++, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ));
|
||||
|
@ -2292,7 +2290,7 @@ void NetworkGeometry::setGeometry(const FBXGeometry& geometry) {
|
|||
networkMesh._vertexBuffer->setSubData(clusterWeightsOffset,
|
||||
mesh.clusterWeights.size() * sizeof(glm::vec4), (gpu::Byte*) mesh.clusterWeights.constData());
|
||||
|
||||
networkMesh._vertexStream = gpu::BufferStreamPointer(new gpu::BufferStream());
|
||||
networkMesh._vertexStream = std::make_shared<gpu::BufferStream>();
|
||||
if (mesh.tangents.size()) networkMesh._vertexStream->addBuffer(networkMesh._vertexBuffer, 0, sizeof(glm::vec3));
|
||||
if (mesh.colors.size()) networkMesh._vertexStream->addBuffer(networkMesh._vertexBuffer, colorsOffset, sizeof(glm::vec3));
|
||||
if (mesh.texCoords.size()) networkMesh._vertexStream->addBuffer(networkMesh._vertexBuffer, texCoordsOffset, sizeof(glm::vec2));
|
||||
|
@ -2300,7 +2298,7 @@ void NetworkGeometry::setGeometry(const FBXGeometry& geometry) {
|
|||
if (mesh.clusterWeights.size()) networkMesh._vertexStream->addBuffer(networkMesh._vertexBuffer, clusterWeightsOffset, sizeof(glm::vec4));
|
||||
|
||||
int channelNum = 0;
|
||||
networkMesh._vertexFormat = gpu::Stream::FormatPointer(new gpu::Stream::Format());
|
||||
networkMesh._vertexFormat = std::make_shared<gpu::Stream::Format>();
|
||||
networkMesh._vertexFormat->setAttribute(gpu::Stream::POSITION, channelNum++, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ));
|
||||
if (mesh.normals.size()) networkMesh._vertexFormat->setAttribute(gpu::Stream::NORMAL, channelNum++, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ));
|
||||
if (mesh.tangents.size()) networkMesh._vertexFormat->setAttribute(gpu::Stream::TANGENT, channelNum++, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ));
|
||||
|
|
|
@ -114,11 +114,11 @@ void Model::RenderPipelineLib::addRenderPipeline(Model::RenderKey key,
|
|||
gpu::Shader::makeProgram(*program, slotBindings);
|
||||
|
||||
|
||||
auto locations = std::shared_ptr<Locations>(new Locations());
|
||||
auto locations = std::make_shared<Locations>();
|
||||
initLocations(program, *locations);
|
||||
|
||||
|
||||
gpu::StatePointer state = gpu::StatePointer(new gpu::State());
|
||||
auto state = std::make_shared<gpu::State>();
|
||||
|
||||
// Backface on shadow
|
||||
if (key.isShadow()) {
|
||||
|
@ -145,7 +145,7 @@ void Model::RenderPipelineLib::addRenderPipeline(Model::RenderKey key,
|
|||
if (!key.isWireFrame()) {
|
||||
|
||||
RenderKey wireframeKey(key.getRaw() | RenderKey::IS_WIREFRAME);
|
||||
gpu::StatePointer wireframeState = gpu::StatePointer(new gpu::State(state->getValues()));
|
||||
auto wireframeState = std::make_shared<gpu::State>(state->getValues());
|
||||
|
||||
wireframeState->setFillMode(gpu::State::FILL_LINE);
|
||||
|
||||
|
@ -158,7 +158,7 @@ void Model::RenderPipelineLib::addRenderPipeline(Model::RenderKey key,
|
|||
if (!key.isShadow()) {
|
||||
|
||||
RenderKey mirrorKey(key.getRaw() | RenderKey::IS_MIRROR);
|
||||
gpu::StatePointer mirrorState = gpu::StatePointer(new gpu::State(state->getValues()));
|
||||
auto mirrorState = std::make_shared<gpu::State>(state->getValues());
|
||||
|
||||
mirrorState->setFrontFaceClockwise(true);
|
||||
|
||||
|
@ -168,7 +168,7 @@ void Model::RenderPipelineLib::addRenderPipeline(Model::RenderKey key,
|
|||
|
||||
if (!key.isWireFrame()) {
|
||||
RenderKey wireframeKey(key.getRaw() | RenderKey::IS_MIRROR | RenderKey::IS_WIREFRAME);
|
||||
gpu::StatePointer wireframeState = gpu::StatePointer(new gpu::State(state->getValues()));;
|
||||
auto wireframeState = std::make_shared<gpu::State>(state->getValues());
|
||||
|
||||
wireframeState->setFillMode(gpu::State::FILL_LINE);
|
||||
|
||||
|
@ -476,8 +476,8 @@ bool Model::updateGeometry() {
|
|||
MeshState state;
|
||||
state.clusterMatrices.resize(mesh.clusters.size());
|
||||
_meshStates.append(state);
|
||||
|
||||
gpu::BufferPointer buffer(new gpu::Buffer());
|
||||
|
||||
auto buffer = std::make_shared<gpu::Buffer>();
|
||||
if (!mesh.blendshapes.isEmpty()) {
|
||||
buffer->resize((mesh.vertices.size() + mesh.normals.size()) * sizeof(glm::vec3));
|
||||
buffer->setSubData(0, mesh.vertices.size() * sizeof(glm::vec3), (gpu::Byte*) mesh.vertices.constData());
|
||||
|
@ -886,7 +886,7 @@ bool Model::addToScene(std::shared_ptr<render::Scene> scene, render::PendingChan
|
|||
foreach (auto renderItem, _transparentRenderItems) {
|
||||
auto item = scene->allocateID();
|
||||
auto renderData = MeshPartPayload::Pointer(renderItem);
|
||||
auto renderPayload = render::PayloadPointer(new MeshPartPayload::Payload(renderData));
|
||||
auto renderPayload = std::make_shared<MeshPartPayload::Payload>(renderData);
|
||||
pendingChanges.resetItem(item, renderPayload);
|
||||
_renderItems.insert(item, renderPayload);
|
||||
somethingAdded = true;
|
||||
|
@ -895,7 +895,7 @@ bool Model::addToScene(std::shared_ptr<render::Scene> scene, render::PendingChan
|
|||
foreach (auto renderItem, _opaqueRenderItems) {
|
||||
auto item = scene->allocateID();
|
||||
auto renderData = MeshPartPayload::Pointer(renderItem);
|
||||
auto renderPayload = render::PayloadPointer(new MeshPartPayload::Payload(renderData));
|
||||
auto renderPayload = std::make_shared<MeshPartPayload::Payload>(renderData);
|
||||
pendingChanges.resetItem(item, renderPayload);
|
||||
_renderItems.insert(item, renderPayload);
|
||||
somethingAdded = true;
|
||||
|
@ -916,7 +916,7 @@ bool Model::addToScene(std::shared_ptr<render::Scene> scene, render::PendingChan
|
|||
foreach (auto renderItem, _transparentRenderItems) {
|
||||
auto item = scene->allocateID();
|
||||
auto renderData = MeshPartPayload::Pointer(renderItem);
|
||||
auto renderPayload = render::PayloadPointer(new MeshPartPayload::Payload(renderData));
|
||||
auto renderPayload = std::make_shared<MeshPartPayload::Payload>(renderData);
|
||||
renderPayload->addStatusGetters(statusGetters);
|
||||
pendingChanges.resetItem(item, renderPayload);
|
||||
_renderItems.insert(item, renderPayload);
|
||||
|
@ -926,7 +926,7 @@ bool Model::addToScene(std::shared_ptr<render::Scene> scene, render::PendingChan
|
|||
foreach (auto renderItem, _opaqueRenderItems) {
|
||||
auto item = scene->allocateID();
|
||||
auto renderData = MeshPartPayload::Pointer(renderItem);
|
||||
auto renderPayload = render::PayloadPointer(new MeshPartPayload::Payload(renderData));
|
||||
auto renderPayload = std::make_shared<MeshPartPayload::Payload>(renderData);
|
||||
renderPayload->addStatusGetters(statusGetters);
|
||||
pendingChanges.resetItem(item, renderPayload);
|
||||
_renderItems.insert(item, renderPayload);
|
||||
|
@ -2156,9 +2156,9 @@ void Model::segregateMeshGroups() {
|
|||
for (int partIndex = 0; partIndex < totalParts; partIndex++) {
|
||||
// this is a good place to create our renderPayloads
|
||||
if (translucentMesh) {
|
||||
_transparentRenderItems << std::shared_ptr<MeshPartPayload>(new MeshPartPayload(true, this, i, partIndex));
|
||||
_transparentRenderItems << std::make_shared<MeshPartPayload>(true, this, i, partIndex);
|
||||
} else {
|
||||
_opaqueRenderItems << std::shared_ptr<MeshPartPayload>(new MeshPartPayload(false, this, i, partIndex));
|
||||
_opaqueRenderItems << std::make_shared<MeshPartPayload>(false, this, i, partIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2206,7 +2206,7 @@ bool Model::initWhenReady(render::ScenePointer scene) {
|
|||
foreach (auto renderItem, _transparentRenderItems) {
|
||||
auto item = scene->allocateID();
|
||||
auto renderData = MeshPartPayload::Pointer(renderItem);
|
||||
auto renderPayload = render::PayloadPointer(new MeshPartPayload::Payload(renderData));
|
||||
auto renderPayload = std::make_shared<MeshPartPayload::Payload>(renderData);
|
||||
_renderItems.insert(item, renderPayload);
|
||||
pendingChanges.resetItem(item, renderPayload);
|
||||
}
|
||||
|
@ -2214,7 +2214,7 @@ bool Model::initWhenReady(render::ScenePointer scene) {
|
|||
foreach (auto renderItem, _opaqueRenderItems) {
|
||||
auto item = scene->allocateID();
|
||||
auto renderData = MeshPartPayload::Pointer(renderItem);
|
||||
auto renderPayload = render::PayloadPointer(new MeshPartPayload::Payload(renderData));
|
||||
auto renderPayload = std::make_shared<MeshPartPayload::Payload>(renderData);
|
||||
_renderItems.insert(item, renderPayload);
|
||||
pendingChanges.resetItem(item, renderPayload);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
#include "OglplusHelpers.h"
|
||||
#include <QSharedPointer>
|
||||
|
||||
using namespace oglplus;
|
||||
using namespace oglplus::shapes;
|
||||
|
@ -49,7 +50,7 @@ ProgramPtr loadDefaultShader() {
|
|||
void compileProgram(ProgramPtr & result, const std::string& vs, const std::string& fs) {
|
||||
using namespace oglplus;
|
||||
try {
|
||||
result = ProgramPtr(new Program());
|
||||
result = std::make_shared<Program>();
|
||||
// attach the shaders to the program
|
||||
result->AttachShader(
|
||||
VertexShader()
|
||||
|
|
|
@ -79,9 +79,9 @@ RenderDeferredTask::RenderDeferredTask() : Task() {
|
|||
_jobs.push_back(Job(new ResetGLState::JobModel()));
|
||||
|
||||
// Give ourselves 3 frmaes of timer queries
|
||||
_timerQueries.push_back(gpu::QueryPointer(new gpu::Query()));
|
||||
_timerQueries.push_back(gpu::QueryPointer(new gpu::Query()));
|
||||
_timerQueries.push_back(gpu::QueryPointer(new gpu::Query()));
|
||||
_timerQueries.push_back(std::make_shared<gpu::Query>());
|
||||
_timerQueries.push_back(std::make_shared<gpu::Query>());
|
||||
_timerQueries.push_back(std::make_shared<gpu::Query>());
|
||||
_currentTimerQueryIndex = 0;
|
||||
}
|
||||
|
||||
|
@ -196,8 +196,8 @@ const gpu::PipelinePointer& DrawOverlay3D::getOpaquePipeline() {
|
|||
auto vs = gpu::ShaderPointer(gpu::Shader::createVertex(std::string(overlay3D_vert)));
|
||||
auto ps = gpu::ShaderPointer(gpu::Shader::createPixel(std::string(overlay3D_frag)));
|
||||
auto program = gpu::ShaderPointer(gpu::Shader::createProgram(vs, ps));
|
||||
|
||||
auto state = gpu::StatePointer(new gpu::State());
|
||||
|
||||
auto state = std::make_shared<gpu::State>();
|
||||
state->setDepthTest(true, true, gpu::LESS_EQUAL);
|
||||
|
||||
_opaquePipeline.reset(gpu::Pipeline::create(program, state));
|
||||
|
|
|
@ -40,7 +40,6 @@ TextRenderer3D* TextRenderer3D::getInstance(const char* family, float pointSize,
|
|||
|
||||
TextRenderer3D::TextRenderer3D(const char* family, float pointSize, int weight, bool italic,
|
||||
EffectType effect, int effectThickness) :
|
||||
_pointSize(pointSize),
|
||||
_effectType(effect),
|
||||
_effectThickness(effectThickness),
|
||||
_font(Font::load(family)) {
|
||||
|
|
|
@ -54,7 +54,6 @@ private:
|
|||
|
||||
// text color
|
||||
glm::vec4 _color;
|
||||
float _pointSize{ DEFAULT_POINT_SIZE };
|
||||
|
||||
Font* _font;
|
||||
};
|
||||
|
|
|
@ -736,7 +736,7 @@ DilatableNetworkTexture::DilatableNetworkTexture(const QUrl& url, const QByteArr
|
|||
QSharedPointer<Texture> DilatableNetworkTexture::getDilatedTexture(float dilation) {
|
||||
QSharedPointer<Texture> texture = _dilatedTextures.value(dilation);
|
||||
if (texture.isNull()) {
|
||||
texture = QSharedPointer<Texture>(new Texture());
|
||||
texture = QSharedPointer<Texture>::create();
|
||||
|
||||
if (!_image.isNull()) {
|
||||
QImage dilatedImage = _image;
|
||||
|
|
|
@ -1,63 +1,17 @@
|
|||
<@include gpu/Config.slh@>
|
||||
<$VERSION_HEADER$>
|
||||
#line __LINE__
|
||||
// Generated on <$_SCRIBE_DATE$>
|
||||
// stars.frag
|
||||
// fragment shader
|
||||
//
|
||||
// Created by Bradley Austin Davis on 2015/06/19
|
||||
// Created by Bradley Austin Davis on 6/10/15.
|
||||
// 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
|
||||
//
|
||||
|
||||
varying vec2 varTexcoord;
|
||||
varying vec3 varNomral;
|
||||
varying vec3 varPosition;
|
||||
|
||||
uniform float iGlobalTime;
|
||||
|
||||
const float PI = 3.14159;
|
||||
const float TAU = 3.14159 * 2.0;
|
||||
const int latitudeCount = 5;
|
||||
const float latitudeDist = PI / 2.0 / float(latitudeCount);
|
||||
const int meridianCount = 4;
|
||||
const float merdianDist = PI / float(meridianCount);
|
||||
|
||||
|
||||
float clampLine(float val, float target) {
|
||||
return clamp((1.0 - abs((val - target)) - 0.998) * 500.0, 0.0, 1.0);
|
||||
}
|
||||
|
||||
float latitude(vec2 pos, float angle) {
|
||||
float result = clampLine(pos.y, angle);
|
||||
if (angle != 0.0) {
|
||||
result += clampLine(pos.y, -angle);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
float meridian(vec2 pos, float angle) {
|
||||
return clampLine(pos.x, angle) + clampLine(pos.x + PI, angle);
|
||||
}
|
||||
|
||||
vec2 toPolar(in vec3 dir) {
|
||||
vec2 polar = vec2(atan(dir.z, dir.x), asin(dir.y));
|
||||
return polar;
|
||||
}
|
||||
|
||||
void mainVR( out vec4 fragColor, in vec2 fragCoord, in vec3 fragRayOri, in vec3 fragRayDir )
|
||||
{
|
||||
vec2 polar = toPolar(fragRayDir);
|
||||
//polar.x += mod(iGlobalTime / 12.0, PI / 4.0) - PI / 4.0;
|
||||
float c = 0.0;
|
||||
for (int i = 0; i < latitudeCount - 1; ++i) {
|
||||
c += latitude(polar, float(i) * latitudeDist);
|
||||
}
|
||||
for (int i = 0; i < meridianCount; ++i) {
|
||||
c += meridian(polar, float(i) * merdianDist);
|
||||
}
|
||||
const vec3 col_lines = vec3(102.0 / 255.0, 136.0 / 255.0, 221.0 / 255.0);
|
||||
fragColor = vec4(c * col_lines, 0.2);
|
||||
}
|
||||
varying vec4 varColor;
|
||||
|
||||
void main(void) {
|
||||
mainVR(gl_FragColor, gl_FragCoord.xy, vec3(0.0), normalize(varPosition));
|
||||
gl_FragColor = varColor; //vec4(varColor, 1.0);
|
||||
}
|
||||
|
||||
|
|
32
libraries/render-utils/src/stars.slv
Normal file
32
libraries/render-utils/src/stars.slv
Normal file
|
@ -0,0 +1,32 @@
|
|||
<@include gpu/Config.slh@>
|
||||
<$VERSION_HEADER$>
|
||||
// Generated on <$_SCRIBE_DATE$>
|
||||
//
|
||||
// standardTransformPNTC.slv
|
||||
// vertex shader
|
||||
//
|
||||
// Created by Sam Gateau on 6/10/2015.
|
||||
// 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 gpu/Transform.slh@>
|
||||
|
||||
<$declareStandardTransform()$>
|
||||
|
||||
varying vec3 varPosition;
|
||||
varying vec4 varColor;
|
||||
|
||||
|
||||
void main(void) {
|
||||
varColor = gl_Color.rgba;
|
||||
|
||||
// standard transform
|
||||
TransformCamera cam = getTransformCamera();
|
||||
TransformObject obj = getTransformObject();
|
||||
<$transformModelToClipPos(cam, obj, gl_Vertex, gl_Position)$>
|
||||
varPosition = gl_Vertex.xyz;
|
||||
gl_PointSize = gl_Color.a;
|
||||
}
|
63
libraries/render-utils/src/starsGrid.slf
Normal file
63
libraries/render-utils/src/starsGrid.slf
Normal file
|
@ -0,0 +1,63 @@
|
|||
<@include gpu/Config.slh@>
|
||||
<$VERSION_HEADER$>
|
||||
#line __LINE__
|
||||
// Generated on <$_SCRIBE_DATE$>
|
||||
// stars.frag
|
||||
// fragment shader
|
||||
//
|
||||
// Created by Bradley Austin Davis on 2015/06/19
|
||||
|
||||
varying vec2 varTexcoord;
|
||||
varying vec3 varNomral;
|
||||
varying vec3 varPosition;
|
||||
|
||||
uniform float iGlobalTime;
|
||||
|
||||
const float PI = 3.14159;
|
||||
const float TAU = 3.14159 * 2.0;
|
||||
const int latitudeCount = 5;
|
||||
const float latitudeDist = PI / 2.0 / float(latitudeCount);
|
||||
const int meridianCount = 4;
|
||||
const float merdianDist = PI / float(meridianCount);
|
||||
|
||||
|
||||
float clampLine(float val, float target) {
|
||||
return clamp((1.0 - abs((val - target)) - 0.998) * 500.0, 0.0, 1.0);
|
||||
}
|
||||
|
||||
float latitude(vec2 pos, float angle) {
|
||||
float result = clampLine(pos.y, angle);
|
||||
if (angle != 0.0) {
|
||||
result += clampLine(pos.y, -angle);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
float meridian(vec2 pos, float angle) {
|
||||
return clampLine(pos.x, angle) + clampLine(pos.x + PI, angle);
|
||||
}
|
||||
|
||||
vec2 toPolar(in vec3 dir) {
|
||||
vec2 polar = vec2(atan(dir.z, dir.x), asin(dir.y));
|
||||
return polar;
|
||||
}
|
||||
|
||||
void mainVR( out vec4 fragColor, in vec2 fragCoord, in vec3 fragRayOri, in vec3 fragRayDir )
|
||||
{
|
||||
vec2 polar = toPolar(fragRayDir);
|
||||
//polar.x += mod(iGlobalTime / 12.0, PI / 4.0) - PI / 4.0;
|
||||
float c = 0.0;
|
||||
for (int i = 0; i < latitudeCount - 1; ++i) {
|
||||
c += latitude(polar, float(i) * latitudeDist);
|
||||
}
|
||||
for (int i = 0; i < meridianCount; ++i) {
|
||||
c += meridian(polar, float(i) * merdianDist);
|
||||
}
|
||||
const vec3 col_lines = vec3(102.0 / 255.0, 136.0 / 255.0, 221.0 / 255.0);
|
||||
fragColor = vec4(c * col_lines, 0.2);
|
||||
}
|
||||
|
||||
void main(void) {
|
||||
mainVR(gl_FragColor, gl_FragCoord.xy, vec3(0.0), normalize(varPosition));
|
||||
}
|
||||
|
|
@ -223,7 +223,7 @@ void Font::setupGPU() {
|
|||
_outlineLoc = program->getUniforms().findLocation("Outline");
|
||||
_colorLoc = program->getUniforms().findLocation("Color");
|
||||
|
||||
gpu::StatePointer state = gpu::StatePointer(new gpu::State());
|
||||
auto state = std::make_shared<gpu::State>();
|
||||
state->setCullMode(gpu::State::CULL_BACK);
|
||||
state->setDepthTest(true, true, gpu::LESS_EQUAL);
|
||||
state->setBlendFunction(true,
|
||||
|
@ -240,14 +240,14 @@ void Font::setupGPU() {
|
|||
assert(sizeof(QuadBuilder) == 4 * sizeof(TextureVertex));
|
||||
|
||||
// Setup rendering structures
|
||||
_format.reset(new gpu::Stream::Format());
|
||||
_format = std::make_shared<gpu::Stream::Format>();
|
||||
_format->setAttribute(gpu::Stream::POSITION, 0, gpu::Element(gpu::VEC2, gpu::FLOAT, gpu::XYZ), 0);
|
||||
_format->setAttribute(gpu::Stream::TEXCOORD, 0, gpu::Element(gpu::VEC2, gpu::FLOAT, gpu::UV), OFFSET);
|
||||
}
|
||||
}
|
||||
|
||||
void Font::rebuildVertices(float x, float y, const QString& str, const glm::vec2& bounds) {
|
||||
_verticesBuffer.reset(new gpu::Buffer());
|
||||
_verticesBuffer = std::make_shared<gpu::Buffer>();
|
||||
_numVertices = 0;
|
||||
_lastStringRendered = str;
|
||||
_lastBounds = bounds;
|
||||
|
|
|
@ -34,27 +34,27 @@ using namespace render;
|
|||
|
||||
|
||||
const gpu::PipelinePointer& DrawStatus::getDrawItemBoundsPipeline() {
|
||||
if (!_drawItemBoundsPipeline) {
|
||||
auto vs = gpu::ShaderPointer(gpu::Shader::createVertex(std::string(drawItemBounds_vert)));
|
||||
auto ps = gpu::ShaderPointer(gpu::Shader::createPixel(std::string(drawItemBounds_frag)));
|
||||
gpu::ShaderPointer program = gpu::ShaderPointer(gpu::Shader::createProgram(vs, ps));
|
||||
|
||||
gpu::Shader::BindingSet slotBindings;
|
||||
gpu::Shader::makeProgram(*program, slotBindings);
|
||||
|
||||
_drawItemBoundPosLoc = program->getUniforms().findLocation("inBoundPos");
|
||||
_drawItemBoundDimLoc = program->getUniforms().findLocation("inBoundDim");
|
||||
|
||||
gpu::StatePointer state = gpu::StatePointer(new gpu::State());
|
||||
|
||||
state->setDepthTest(true, false, gpu::LESS_EQUAL);
|
||||
|
||||
// Blend on transparent
|
||||
state->setBlendFunction(true,
|
||||
gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA,
|
||||
gpu::State::DEST_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ZERO);
|
||||
|
||||
// Good to go add the brand new pipeline
|
||||
if (!_drawItemBoundsPipeline) {
|
||||
auto vs = gpu::ShaderPointer(gpu::Shader::createVertex(std::string(drawItemBounds_vert)));
|
||||
auto ps = gpu::ShaderPointer(gpu::Shader::createPixel(std::string(drawItemBounds_frag)));
|
||||
gpu::ShaderPointer program = gpu::ShaderPointer(gpu::Shader::createProgram(vs, ps));
|
||||
|
||||
gpu::Shader::BindingSet slotBindings;
|
||||
gpu::Shader::makeProgram(*program, slotBindings);
|
||||
|
||||
_drawItemBoundPosLoc = program->getUniforms().findLocation("inBoundPos");
|
||||
_drawItemBoundDimLoc = program->getUniforms().findLocation("inBoundDim");
|
||||
|
||||
auto state = std::make_shared<gpu::State>();
|
||||
|
||||
state->setDepthTest(true, false, gpu::LESS_EQUAL);
|
||||
|
||||
// Blend on transparent
|
||||
state->setBlendFunction(true,
|
||||
gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA,
|
||||
gpu::State::DEST_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ZERO);
|
||||
|
||||
// Good to go add the brand new pipeline
|
||||
_drawItemBoundsPipeline.reset(gpu::Pipeline::create(program, state));
|
||||
}
|
||||
return _drawItemBoundsPipeline;
|
||||
|
@ -62,27 +62,27 @@ const gpu::PipelinePointer& DrawStatus::getDrawItemBoundsPipeline() {
|
|||
|
||||
const gpu::PipelinePointer& DrawStatus::getDrawItemStatusPipeline() {
|
||||
if (!_drawItemStatusPipeline) {
|
||||
auto vs = gpu::ShaderPointer(gpu::Shader::createVertex(std::string(drawItemStatus_vert)));
|
||||
auto ps = gpu::ShaderPointer(gpu::Shader::createPixel(std::string(drawItemStatus_frag)));
|
||||
gpu::ShaderPointer program = gpu::ShaderPointer(gpu::Shader::createProgram(vs, ps));
|
||||
|
||||
gpu::Shader::BindingSet slotBindings;
|
||||
gpu::Shader::makeProgram(*program, slotBindings);
|
||||
|
||||
_drawItemStatusPosLoc = program->getUniforms().findLocation("inBoundPos");
|
||||
_drawItemStatusDimLoc = program->getUniforms().findLocation("inBoundDim");
|
||||
_drawItemStatusValueLoc = program->getUniforms().findLocation("inStatus");
|
||||
|
||||
gpu::StatePointer state = gpu::StatePointer(new gpu::State());
|
||||
|
||||
state->setDepthTest(false, false, gpu::LESS_EQUAL);
|
||||
|
||||
// Blend on transparent
|
||||
state->setBlendFunction(true,
|
||||
gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA,
|
||||
gpu::State::DEST_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ZERO);
|
||||
|
||||
// Good to go add the brand new pipeline
|
||||
auto vs = gpu::ShaderPointer(gpu::Shader::createVertex(std::string(drawItemStatus_vert)));
|
||||
auto ps = gpu::ShaderPointer(gpu::Shader::createPixel(std::string(drawItemStatus_frag)));
|
||||
gpu::ShaderPointer program = gpu::ShaderPointer(gpu::Shader::createProgram(vs, ps));
|
||||
|
||||
gpu::Shader::BindingSet slotBindings;
|
||||
gpu::Shader::makeProgram(*program, slotBindings);
|
||||
|
||||
_drawItemStatusPosLoc = program->getUniforms().findLocation("inBoundPos");
|
||||
_drawItemStatusDimLoc = program->getUniforms().findLocation("inBoundDim");
|
||||
_drawItemStatusValueLoc = program->getUniforms().findLocation("inStatus");
|
||||
|
||||
auto state = std::make_shared<gpu::State>();
|
||||
|
||||
state->setDepthTest(false, false, gpu::LESS_EQUAL);
|
||||
|
||||
// Blend on transparent
|
||||
state->setBlendFunction(true,
|
||||
gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA,
|
||||
gpu::State::DEST_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ZERO);
|
||||
|
||||
// Good to go add the brand new pipeline
|
||||
_drawItemStatusPipeline.reset(gpu::Pipeline::create(program, state));
|
||||
}
|
||||
return _drawItemStatusPipeline;
|
||||
|
@ -98,10 +98,10 @@ void DrawStatus::run(const SceneContextPointer& sceneContext, const RenderContex
|
|||
int nbItems = 0;
|
||||
{
|
||||
if (!_itemBounds) {
|
||||
_itemBounds.reset(new gpu::Buffer());
|
||||
_itemBounds = std::make_shared<gpu::Buffer>();
|
||||
}
|
||||
if (!_itemStatus) {
|
||||
_itemStatus.reset(new gpu::Buffer());
|
||||
_itemStatus = std::make_shared<gpu::Buffer>();;
|
||||
}
|
||||
|
||||
_itemBounds->resize((inItems.size() * sizeof(AABox)));
|
||||
|
@ -148,14 +148,14 @@ void DrawStatus::run(const SceneContextPointer& sceneContext, const RenderContex
|
|||
|
||||
AABox* itemAABox = reinterpret_cast<AABox*> (_itemBounds->editData());
|
||||
glm::ivec4* itemStatus = reinterpret_cast<glm::ivec4*> (_itemStatus->editData());
|
||||
|
||||
const unsigned int VEC3_ADRESS_OFFSET = 3;
|
||||
|
||||
|
||||
const unsigned int VEC3_ADRESS_OFFSET = 3;
|
||||
|
||||
for (int i = 0; i < nbItems; i++) {
|
||||
batch._glUniform3fv(_drawItemBoundPosLoc, 1, (const GLfloat*) (itemAABox + i));
|
||||
batch._glUniform3fv(_drawItemBoundDimLoc, 1, ((const GLfloat*) (itemAABox + i)) + VEC3_ADRESS_OFFSET);
|
||||
|
||||
batch.draw(gpu::LINES, 24, 0);
|
||||
batch.draw(gpu::LINES, 24, 0);
|
||||
}
|
||||
|
||||
batch.setPipeline(getDrawItemStatusPipeline());
|
||||
|
|
|
@ -43,11 +43,11 @@ public:
|
|||
|
||||
Varying() {}
|
||||
template <class T>
|
||||
Varying(const T& data) : _concept(new Job::Varying::Model<T>(data)) {}
|
||||
Varying(const T& data) : _concept(std::make_shared<Job::Varying::Model<T>>(data)) {}
|
||||
|
||||
// Access the _data contained win the concept explicitely
|
||||
template <class T> T& edit() { return (static_cast<Model<T>*> (_concept.get())->_data); }
|
||||
template <class T> const T& get() const { return (static_cast<const Model<T>*> (_concept.get())->_data); }
|
||||
template <class T> T& edit() { return std::static_pointer_cast<Model<T>>(_concept)->_data; }
|
||||
template <class T> const T& get() const { return std::static_pointer_cast<const Model<T>>(_concept)->_data; }
|
||||
|
||||
protected:
|
||||
friend class Job;
|
||||
|
|
|
@ -15,8 +15,8 @@ using namespace render;
|
|||
|
||||
|
||||
Engine::Engine() :
|
||||
_sceneContext(new SceneContext()),
|
||||
_renderContext(new RenderContext())
|
||||
_sceneContext(std::make_shared<SceneContext>()),
|
||||
_renderContext(std::make_shared<RenderContext>())
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -45,6 +45,6 @@ void Engine::buildStandardTaskPipeline() {
|
|||
_tasks.clear();
|
||||
}
|
||||
|
||||
addTask(TaskPointer(new DrawSceneTask()));
|
||||
addTask(std::make_shared<DrawSceneTask>());
|
||||
}
|
||||
|
||||
|
|
|
@ -87,14 +87,14 @@ void Item::Status::getPackedValues(glm::ivec4& values) const {
|
|||
|
||||
void Item::PayloadInterface::addStatusGetter(const Status::Getter& getter) {
|
||||
if (!_status) {
|
||||
_status.reset(new Status());
|
||||
_status = std::make_shared<Status>();
|
||||
}
|
||||
_status->addGetter(getter);
|
||||
}
|
||||
|
||||
void Item::PayloadInterface::addStatusGetters(const Status::Getters& getters) {
|
||||
if (!_status) {
|
||||
_status.reset(new Status());
|
||||
_status = std::make_shared<Status>();
|
||||
}
|
||||
for (auto& g : getters) {
|
||||
_status->addGetter(g);
|
||||
|
|
|
@ -364,7 +364,7 @@ protected:
|
|||
DataPointer _data;
|
||||
|
||||
// Update mechanics
|
||||
virtual void update(const UpdateFunctorPointer& functor) { static_cast<Updater*>(functor.get())->_func((*_data)); }
|
||||
virtual void update(const UpdateFunctorPointer& functor) { std::static_pointer_cast<Updater>(functor)->_func((*_data)); }
|
||||
friend class Item;
|
||||
};
|
||||
|
||||
|
@ -448,7 +448,7 @@ public:
|
|||
void removeItem(ItemID id);
|
||||
|
||||
template <class T> void updateItem(ItemID id, std::function<void(T&)> func) {
|
||||
updateItem(id, UpdateFunctorPointer(new UpdateFunctor<T>(func)));
|
||||
updateItem(id, std::make_shared<UpdateFunctor<T>>(func));
|
||||
}
|
||||
|
||||
void updateItem(ItemID id, const UpdateFunctorPointer& functor);
|
||||
|
|
|
@ -117,7 +117,7 @@ protected:
|
|||
SceneScriptingInterface() {};
|
||||
~SceneScriptingInterface() {};
|
||||
|
||||
model::SunSkyStagePointer _skyStage = model::SunSkyStagePointer(new model::SunSkyStage());
|
||||
model::SunSkyStagePointer _skyStage = std::make_shared<model::SunSkyStage>();
|
||||
|
||||
bool _shouldRenderAvatars = true;
|
||||
bool _shouldRenderEntities = true;
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include <QDebug>
|
||||
|
||||
#include "ScriptEngineLogging.h"
|
||||
#include "NumericalConstants.h"
|
||||
#include "Vec3.h"
|
||||
|
||||
glm::vec3 Vec3::reflect(const glm::vec3& v1, const glm::vec3& v2) {
|
||||
|
@ -73,3 +74,52 @@ void Vec3::print(const QString& lable, const glm::vec3& v) {
|
|||
bool Vec3::equal(const glm::vec3& v1, const glm::vec3& v2) {
|
||||
return v1 == v2;
|
||||
}
|
||||
|
||||
glm::vec3 Vec3::toPolar(const glm::vec3& v) {
|
||||
float radius = length(v);
|
||||
if (glm::abs(radius) < EPSILON) {
|
||||
return glm::vec3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
glm::vec3 u = v / radius;
|
||||
|
||||
float elevation, azimuth;
|
||||
|
||||
elevation = glm::asin(-u.y);
|
||||
azimuth = atan2(v.x, v.z);
|
||||
|
||||
// Round off small decimal values
|
||||
if (glm::abs(elevation) < EPSILON) {
|
||||
elevation = 0.0f;
|
||||
}
|
||||
if (glm::abs(azimuth) < EPSILON) {
|
||||
azimuth = 0.0f;
|
||||
}
|
||||
|
||||
return glm::vec3(elevation, azimuth, radius);
|
||||
}
|
||||
|
||||
glm::vec3 Vec3::fromPolar(const glm::vec3& polar) {
|
||||
float x = glm::cos(polar.x) * glm::sin(polar.y);
|
||||
float y = glm::sin(-polar.x);
|
||||
float z = glm::cos(polar.x) * glm::cos(polar.y);
|
||||
|
||||
// Round small values to 0
|
||||
if (glm::abs(x) < EPSILON) {
|
||||
x = 0.0f;
|
||||
}
|
||||
if (glm::abs(y) < EPSILON) {
|
||||
y = 0.0f;
|
||||
}
|
||||
if (glm::abs(z) < EPSILON) {
|
||||
z = 0.0f;
|
||||
}
|
||||
|
||||
return polar.z * glm::vec3(x, y, z);
|
||||
}
|
||||
|
||||
glm::vec3 Vec3::fromPolar(float elevation, float azimuth) {
|
||||
glm::vec3 v = glm::vec3(elevation, azimuth, 1.0f);
|
||||
return fromPolar(v);
|
||||
}
|
||||
|
||||
|
|
|
@ -40,6 +40,9 @@ public slots:
|
|||
glm::vec3 mix(const glm::vec3& v1, const glm::vec3& v2, float m);
|
||||
void print(const QString& lable, const glm::vec3& v);
|
||||
bool equal(const glm::vec3& v1, const glm::vec3& v2);
|
||||
glm::vec3 toPolar(const glm::vec3& v);
|
||||
glm::vec3 fromPolar(const glm::vec3& polar);
|
||||
glm::vec3 fromPolar(float elevation, float azimuth);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -158,8 +158,7 @@ protected:
|
|||
mutable Flags _flags;
|
||||
|
||||
// Cached transform
|
||||
// TODO: replace this auto ptr by a "unique ptr" as soon as we are compiling in C++11
|
||||
mutable std::auto_ptr<Mat4> _matrix;
|
||||
mutable std::unique_ptr<Mat4> _matrix;
|
||||
|
||||
bool isCacheInvalid() const { return _flags[FLAG_CACHE_INVALID]; }
|
||||
void validCache() const { _flags.set(FLAG_CACHE_INVALID, false); }
|
||||
|
|
|
@ -25,7 +25,7 @@ InfoView::InfoView(QQuickItem* parent) : QQuickItem(parent) {
|
|||
}
|
||||
|
||||
void InfoView::registerType() {
|
||||
qmlRegisterType<InfoView>("Hifi", 1, 0, NAME.toLocal8Bit().constData());
|
||||
qmlRegisterType<InfoView>("Hifi", 1, 0, NAME.toLocal8Bit().constData());
|
||||
}
|
||||
|
||||
QString fetchVersion(const QUrl& url) {
|
||||
|
|
|
@ -184,7 +184,7 @@ protected:
|
|||
#define SERIF_FONT_FAMILY "Times New Roman"
|
||||
#endif
|
||||
|
||||
static const wchar_t* EXAMPLE_TEXT = L"Hello";
|
||||
//static const wchar_t* EXAMPLE_TEXT = L"Hello";
|
||||
//static const wchar_t* EXAMPLE_TEXT = L"\xC1y Hello 1.0\ny\xC1 line 2\n\xC1y";
|
||||
static const glm::uvec2 QUAD_OFFSET(10, 10);
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ const TextTemplatePointer TextTemplate::Config::addInclude(const ConfigPointer&
|
|||
String includeStream;
|
||||
if (config->_includerCallback(config, include, includeStream)) {
|
||||
// ok, then create a new Template on the include file with this as lib
|
||||
included = TextTemplatePointer(new TextTemplate(include, config));
|
||||
included = std::make_shared<TextTemplate>(include, config);
|
||||
|
||||
std::stringstream src(includeStream);
|
||||
|
||||
|
@ -398,7 +398,7 @@ const BlockPointer TextTemplate::processStepVar(const BlockPointer& block, Strin
|
|||
BlockPointer parent = Block::getCurrentBlock(block);
|
||||
|
||||
// Add a new BLock
|
||||
BlockPointer newBlock = BlockPointer(new Block(_root->sourceName));
|
||||
BlockPointer newBlock = std::make_shared<Block>(_root->sourceName);
|
||||
(newBlock->ostr) << grabbed;
|
||||
|
||||
newBlock->command.type = Command::VAR;
|
||||
|
@ -460,7 +460,7 @@ const BlockPointer TextTemplate::processStepDef(const BlockPointer& block, Strin
|
|||
BlockPointer parent = Block::getCurrentBlock(block);
|
||||
|
||||
// Add a new BLock
|
||||
BlockPointer newBlock = BlockPointer(new Block(_root->sourceName));
|
||||
BlockPointer newBlock = std::make_shared<Block>(_root->sourceName);
|
||||
(newBlock->ostr) << grabbed;
|
||||
|
||||
newBlock->command.type = Command::DEF;
|
||||
|
@ -482,12 +482,12 @@ const BlockPointer TextTemplate::processStepCommandIf(const BlockPointer& block,
|
|||
BlockPointer parent = Block::getCurrentBlock(block);
|
||||
|
||||
// Add a new BLock depth
|
||||
BlockPointer newIfBlock = BlockPointer(new Block(_root->sourceName));
|
||||
BlockPointer newIfBlock = std::make_shared<Block>(_root->sourceName);
|
||||
newIfBlock->command.type = Command::IFBLOCK;
|
||||
|
||||
Block::addNewBlock(parent, newIfBlock);
|
||||
|
||||
BlockPointer newBlock = BlockPointer(new Block(_root->sourceName));
|
||||
BlockPointer newBlock = std::make_shared<Block>(_root->sourceName);
|
||||
(newBlock->ostr) << grabbed;
|
||||
|
||||
newBlock->command.type = Command::IF;
|
||||
|
@ -506,7 +506,7 @@ const BlockPointer TextTemplate::processStepCommandEndIf(const BlockPointer& blo
|
|||
if ((parent->command.type == Command::IF)
|
||||
|| (parent->command.type == Command::ELIF)
|
||||
|| (parent->command.type == Command::ELSE)) {
|
||||
BlockPointer newBlock = BlockPointer(new Block(_root->sourceName));
|
||||
BlockPointer newBlock = std::make_shared<Block>(_root->sourceName);
|
||||
(newBlock->ostr) << grabbed;
|
||||
|
||||
newBlock->command.type = Command::ENDIF;
|
||||
|
@ -533,7 +533,7 @@ const BlockPointer TextTemplate::processStepCommandElse(const BlockPointer& bloc
|
|||
parent = parent->parent;
|
||||
|
||||
// Add a new BLock depth
|
||||
BlockPointer newBlock = BlockPointer(new Block(_root->sourceName));
|
||||
BlockPointer newBlock = std::make_shared<Block>(_root->sourceName);
|
||||
newBlock->ostr << grabbed;
|
||||
newBlock->command.type = Command::ELSE;
|
||||
newBlock->command.arguments.push_back(expression);
|
||||
|
@ -562,7 +562,7 @@ const BlockPointer TextTemplate::processStepCommandElif(const BlockPointer& bloc
|
|||
parent = parent->parent;
|
||||
|
||||
// Add a new BLock depth
|
||||
BlockPointer newBlock = BlockPointer(new Block(_root->sourceName));
|
||||
BlockPointer newBlock = std::make_shared<Block>(_root->sourceName);
|
||||
(newBlock->ostr) << grabbed;
|
||||
|
||||
newBlock->command.type = Command::ELIF;
|
||||
|
@ -595,7 +595,7 @@ const BlockPointer TextTemplate::processStepInclude(const BlockPointer& block, S
|
|||
BlockPointer parent = Block::getCurrentBlock(block);
|
||||
|
||||
// Add a new BLock
|
||||
BlockPointer newBlock = BlockPointer(new Block(_root->sourceName));
|
||||
BlockPointer newBlock = std::make_shared<Block>(_root->sourceName);
|
||||
(newBlock->ostr) << grabbed;
|
||||
|
||||
newBlock->command.type = Command::INCLUDE;
|
||||
|
@ -631,7 +631,7 @@ const BlockPointer TextTemplate::processStepFunc(const BlockPointer& block, Stri
|
|||
BlockPointer parent = Block::getCurrentBlock(block);
|
||||
|
||||
// Add a new BLock
|
||||
BlockPointer newBlock = BlockPointer(new Block(_root->sourceName));
|
||||
BlockPointer newBlock = std::make_shared<Block>(_root->sourceName);
|
||||
(newBlock->ostr) << grabbed;
|
||||
|
||||
newBlock->command.type = Command::FUNC;
|
||||
|
@ -660,7 +660,7 @@ const BlockPointer TextTemplate::processStepEndFunc(const BlockPointer& block, S
|
|||
|
||||
// Everything is cool , so let's unplugg the FUnc block from this tree and just put the EndFunc block
|
||||
|
||||
BlockPointer newBlock = BlockPointer(new Block(_root->sourceName));
|
||||
BlockPointer newBlock = std::make_shared<Block>(_root->sourceName);
|
||||
(newBlock->ostr) << grabbed;
|
||||
|
||||
newBlock->command.type = Command::ENDFUNC;
|
||||
|
|
|
@ -141,7 +141,7 @@ public:
|
|||
|
||||
static bool loadFile(const Config::Pointer& config, const char* filename, String& source);
|
||||
|
||||
TextTemplate(const String& name, const Config::Pointer& config = Config::Pointer(new Config()));
|
||||
TextTemplate(const String& name, const Config::Pointer& config = std::make_shared<Config>());
|
||||
~TextTemplate();
|
||||
|
||||
// Scibe does all the job of parsing an inout template stream and then gneerating theresulting stream using the vars
|
||||
|
|
|
@ -31,7 +31,7 @@ int main (int argc, char** argv) {
|
|||
bool showParseTree = false;
|
||||
bool makeCPlusPlus = false;
|
||||
|
||||
TextTemplate::Config::Pointer config(new TextTemplate::Config());
|
||||
auto config = std::make_shared<TextTemplate::Config>();
|
||||
|
||||
enum Mode {
|
||||
READY = 0,
|
||||
|
@ -165,7 +165,7 @@ int main (int argc, char** argv) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
TextTemplate::Pointer scribe(new TextTemplate(srcFilename, config));
|
||||
auto scribe = std::make_shared<TextTemplate>(srcFilename, config);
|
||||
|
||||
// ready to parse and generate
|
||||
std::ostringstream destStringStream;
|
||||
|
|
Loading…
Reference in a new issue