mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-26 01:35:14 +02:00
commit
8b58aa706a
27 changed files with 136 additions and 726 deletions
|
@ -18,10 +18,16 @@ hifi_library_search_hints("leapmotion")
|
|||
find_path(LEAPMOTION_INCLUDE_DIRS Leap.h PATH_SUFFIXES include HINTS ${LEAPMOTION_SEARCH_DIRS})
|
||||
|
||||
if (WIN32)
|
||||
find_library(LEAPMOTION_LIBRARY_DEBUG Leapd PATH_SUFFIXES lib/x86 HINTS ${LEAPMOTION_SEARCH_DIRS})
|
||||
find_library(LEAPMOTION_LIBRARY_RELEASE Leap PATH_SUFFIXES lib/x86 HINTS ${LEAPMOTION_SEARCH_DIRS})
|
||||
|
||||
find_path(LEAPMOTION_DLL_PATH Leap.dll PATH_SUFFIXES lib/x86 HINTS ${LEAPMOTION_SEARCH_DIRS})
|
||||
if ("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
|
||||
set(ARCH_DIR "x64")
|
||||
else()
|
||||
set(ARCH_DIR "x86")
|
||||
endif()
|
||||
|
||||
find_library(LEAPMOTION_LIBRARY_DEBUG Leapd PATH_SUFFIXES "lib/${ARCH_DIR}" HINTS ${LEAPMOTION_SEARCH_DIRS})
|
||||
find_library(LEAPMOTION_LIBRARY_RELEASE Leap PATH_SUFFIXES "lib/${ARCH_DIR}" HINTS ${LEAPMOTION_SEARCH_DIRS})
|
||||
find_path(LEAPMOTION_DLL_PATH Leap.dll PATH_SUFFIXES "lib/${ARCH_DIR}" HINTS ${LEAPMOTION_SEARCH_DIRS})
|
||||
elseif (APPLE)
|
||||
find_library(LEAPMOTION_LIBRARY_RELEASE Leap PATH_SUFFIXES lib HINTS ${LEAPMOTION_SEARCH_DIRS})
|
||||
endif ()
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
# Try to find the RSSDK library
|
||||
#
|
||||
# You must provide a RSSDK_ROOT_DIR which contains lib and include directories
|
||||
#
|
||||
# Once done this will define
|
||||
#
|
||||
# RSSDK_FOUND - system found RSSDK
|
||||
# RSSDK_INCLUDE_DIRS - the RSSDK include directory
|
||||
# RSSDK_LIBRARIES - Link this to use RSSDK
|
||||
#
|
||||
# Created on 12/7/2014 by Thijs Wenker
|
||||
# Copyright (c) 2014 High Fidelity
|
||||
#
|
||||
|
||||
include("${MACRO_DIR}/HifiLibrarySearchHints.cmake")
|
||||
hifi_library_search_hints("rssdk")
|
||||
|
||||
find_path(RSSDK_INCLUDE_DIRS pxcbase.h PATH_SUFFIXES include HINTS ${RSSDK_SEARCH_DIRS})
|
||||
|
||||
if (WIN32)
|
||||
find_library(RSSDK_LIBRARY_DEBUG libpxc_d PATH_SUFFIXES lib/Win32 HINTS ${RSSDK_SEARCH_DIRS})
|
||||
find_library(RSSDK_LIBRARY_RELEASE libpxc PATH_SUFFIXES lib/Win32 HINTS ${RSSDK_SEARCH_DIRS})
|
||||
endif ()
|
||||
|
||||
include(SelectLibraryConfigurations)
|
||||
select_library_configurations(RSSDK)
|
||||
|
||||
set(RSSDK_LIBRARIES "${RSSDK_LIBRARY}")
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(RSSDK DEFAULT_MSG RSSDK_INCLUDE_DIRS RSSDK_LIBRARIES)
|
||||
|
||||
mark_as_advanced(RSSDK_INCLUDE_DIRS RSSDK_LIBRARIES RSSDK_SEARCH_DIRS)
|
|
@ -1,30 +0,0 @@
|
|||
#
|
||||
# FindRtMidi.cmake
|
||||
#
|
||||
# Try to find the RtMidi library
|
||||
#
|
||||
# You can provide a RTMIDI_ROOT_DIR which contains lib and include directories
|
||||
#
|
||||
# Once done this will define
|
||||
#
|
||||
# RTMIDI_FOUND - system found RtMidi
|
||||
# RTMIDI_INCLUDE_DIRS - the RtMidi include directory
|
||||
# RTMIDI_LIBRARIES - link to this to use RtMidi
|
||||
#
|
||||
# Created on 6/30/2014 by Stephen Birarda
|
||||
# Copyright 2014 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("${MACRO_DIR}/HifiLibrarySearchHints.cmake")
|
||||
hifi_library_search_hints("rtmidi")
|
||||
|
||||
find_path(RTMIDI_INCLUDE_DIRS RtMidi.h PATH_SUFFIXES include HINTS ${RTMIDI_SEARCH_DIRS})
|
||||
find_library(RTMIDI_LIBRARIES NAMES rtmidi PATH_SUFFIXES lib HINTS ${RTMIDI_SEARCH_DIRS})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(RtMidi DEFAULT_MSG RTMIDI_INCLUDE_DIRS RTMIDI_LIBRARIES)
|
||||
|
||||
mark_as_advanced(RTMIDI_INCLUDE_DIRS RTMIDI_LIBRARIES RTMIDI_SEARCH_DIRS)
|
|
@ -2,7 +2,7 @@ set(TARGET_NAME interface)
|
|||
project(${TARGET_NAME})
|
||||
|
||||
# set a default root dir for each of our optional externals if it was not passed
|
||||
set(OPTIONAL_EXTERNALS "LeapMotion" "RtMidi" "RSSDK")
|
||||
set(OPTIONAL_EXTERNALS "LeapMotion")
|
||||
|
||||
if(WIN32)
|
||||
list(APPEND OPTIONAL_EXTERNALS "3DConnexionClient")
|
||||
|
@ -161,13 +161,6 @@ foreach(EXTERNAL ${OPTIONAL_EXTERNALS})
|
|||
endif ()
|
||||
endforeach()
|
||||
|
||||
# special OS X modifications for RtMidi library
|
||||
if (RTMIDI_FOUND AND NOT DISABLE_RTMIDI AND APPLE)
|
||||
find_library(CoreMIDI CoreMIDI)
|
||||
add_definitions(-D__MACOSX_CORE__)
|
||||
target_link_libraries(${TARGET_NAME} ${CoreMIDI})
|
||||
endif ()
|
||||
|
||||
# include headers for interface and InterfaceConfig.
|
||||
include_directories("${PROJECT_SOURCE_DIR}/src")
|
||||
|
||||
|
|
9
interface/external/rssdk/readme.txt
vendored
9
interface/external/rssdk/readme.txt
vendored
|
@ -1,9 +0,0 @@
|
|||
|
||||
Instructions for adding the Intel Realsense (RSSDK) to Interface
|
||||
Thijs Wenker, December 19, 2014
|
||||
|
||||
This is Windows only for now.
|
||||
|
||||
1. Download the SDK at https://software.intel.com/en-us/intel-realsense-sdk/download
|
||||
|
||||
2. Copy the `lib` and `include` folder inside this directory
|
43
interface/external/rtmidi/readme.txt
vendored
43
interface/external/rtmidi/readme.txt
vendored
|
@ -1,43 +0,0 @@
|
|||
|
||||
Instructions for adding the RtMidi library to Interface
|
||||
Stephen Birarda, June 30, 2014
|
||||
|
||||
1. Download the RtMidi tarball from High Fidelity S3.
|
||||
http://public.highfidelity.io/dependencies/rtmidi-2.1.0.tar.gz
|
||||
|
||||
2. Copy RtMidi.h to externals/rtmidi/include.
|
||||
|
||||
3. Compile the RtMidi library.
|
||||
|
||||
3. Copy either librtmidi.dylib (dynamic) or librtmidi.a (static) to externals/rtmidi/lib
|
||||
|
||||
4. Delete your build directory, run cmake and build, and you should be all set.
|
||||
|
||||
=========================
|
||||
|
||||
RtMidi: realtime MIDI i/o C++ classes<BR>
|
||||
Copyright (c) 2003-2014 Gary P. Scavone
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation files
|
||||
(the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
Any person wishing to distribute modifications to the Software is
|
||||
asked to send the modifications to the original developer so that
|
||||
they can be incorporated into the canonical version. This is,
|
||||
however, not a binding provision of this license.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -110,8 +110,6 @@
|
|||
#include "devices/EyeTracker.h"
|
||||
#include "devices/Faceshift.h"
|
||||
#include "devices/Leapmotion.h"
|
||||
#include "devices/MIDIManager.h"
|
||||
#include "devices/RealSense.h"
|
||||
#include "DiscoverabilityManager.h"
|
||||
#include "GLCanvas.h"
|
||||
#include "InterfaceActionFactory.h"
|
||||
|
@ -719,12 +717,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) :
|
|||
// set the local loopback interface for local sounds from audio scripts
|
||||
AudioScriptingInterface::getInstance().setLocalAudioInterface(audioIO.data());
|
||||
|
||||
#ifdef HAVE_RTMIDI
|
||||
// setup the MIDIManager
|
||||
MIDIManager& midiManagerInstance = MIDIManager::getInstance();
|
||||
midiManagerInstance.openDefaultPort();
|
||||
#endif
|
||||
|
||||
this->installEventFilter(this);
|
||||
|
||||
// initialize our face trackers after loading the menu settings
|
||||
|
@ -970,7 +962,6 @@ Application::~Application() {
|
|||
nodeThread->wait();
|
||||
|
||||
Leapmotion::destroy();
|
||||
RealSense::destroy();
|
||||
|
||||
#if 0
|
||||
ConnexionClient::getInstance().destroy();
|
||||
|
@ -2519,7 +2510,6 @@ void Application::init() {
|
|||
qCDebug(interfaceapp) << "Loaded settings";
|
||||
|
||||
Leapmotion::init();
|
||||
RealSense::init();
|
||||
|
||||
// fire off an immediate domain-server check in now that settings are loaded
|
||||
DependencyManager::get<NodeList>()->sendDomainServerCheckIn();
|
||||
|
@ -4067,10 +4057,6 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri
|
|||
scriptEngine->registerGlobalObject("Scene", DependencyManager::get<SceneScriptingInterface>().data());
|
||||
|
||||
scriptEngine->registerGlobalObject("ScriptDiscoveryService", this->getRunningScriptsWidget());
|
||||
|
||||
#ifdef HAVE_RTMIDI
|
||||
scriptEngine->registerGlobalObject("MIDI", &MIDIManager::getInstance());
|
||||
#endif
|
||||
}
|
||||
|
||||
bool Application::canAcceptURL(const QString& urlString) {
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#include "avatar/AvatarManager.h"
|
||||
#include "devices/DdeFaceTracker.h"
|
||||
#include "devices/Faceshift.h"
|
||||
#include "devices/RealSense.h"
|
||||
#include "input-plugins/SpacemouseManager.h"
|
||||
#include "MainWindow.h"
|
||||
#include "scripting/MenuScriptingInterface.h"
|
||||
|
@ -462,12 +461,6 @@ Menu::Menu() {
|
|||
MenuWrapper* leapOptionsMenu = handOptionsMenu->addMenu("Leap Motion");
|
||||
addCheckableActionToQMenuAndActionHash(leapOptionsMenu, MenuOption::LeapMotionOnHMD, 0, false);
|
||||
|
||||
#ifdef HAVE_RSSDK
|
||||
MenuWrapper* realSenseOptionsMenu = handOptionsMenu->addMenu("RealSense");
|
||||
addActionToQMenuAndActionHash(realSenseOptionsMenu, MenuOption::LoadRSSDKFile, 0,
|
||||
RealSense::getInstance(), SLOT(loadRSSDKFile()));
|
||||
#endif
|
||||
|
||||
MenuWrapper* networkMenu = developerMenu->addMenu("Network");
|
||||
addActionToQMenuAndActionHash(networkMenu, MenuOption::ReloadContent, 0, qApp, SLOT(reloadResourceCaches()));
|
||||
addCheckableActionToQMenuAndActionHash(networkMenu, MenuOption::DisableNackPackets, 0, false,
|
||||
|
|
|
@ -211,7 +211,6 @@ namespace MenuOption {
|
|||
const QString LeapMotionOnHMD = "Leap Motion on HMD";
|
||||
const QString LoadScript = "Open and Run Script File...";
|
||||
const QString LoadScriptURL = "Open and Run Script from URL...";
|
||||
const QString LoadRSSDKFile = "Load .rssdk file";
|
||||
const QString LodTools = "LOD Tools";
|
||||
const QString Login = "Login";
|
||||
const QString Log = "Log";
|
||||
|
|
|
@ -1,73 +0,0 @@
|
|||
//
|
||||
// MIDIManager.cpp
|
||||
//
|
||||
//
|
||||
// Created by Stephen Birarda on 2014-06-30.
|
||||
// Copyright 2014 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 <QtCore/QDebug>
|
||||
|
||||
#include "InterfaceLogging.h"
|
||||
#include "MIDIManager.h"
|
||||
|
||||
MIDIManager& MIDIManager::getInstance() {
|
||||
static MIDIManager sharedInstance;
|
||||
return sharedInstance;
|
||||
}
|
||||
|
||||
void MIDIManager::midiCallback(double deltaTime, std::vector<unsigned char>* message, void* userData) {
|
||||
#ifdef HAVE_RTMIDI
|
||||
|
||||
MIDIEvent callbackEvent;
|
||||
callbackEvent.deltaTime = deltaTime;
|
||||
|
||||
callbackEvent.type = message->at(0);
|
||||
|
||||
if (message->size() > 1) {
|
||||
callbackEvent.data1 = message->at(1);
|
||||
}
|
||||
|
||||
if (message->size() > 2) {
|
||||
callbackEvent.data2 = message->at(2);
|
||||
}
|
||||
|
||||
emit getInstance().midiEvent(callbackEvent);
|
||||
#endif
|
||||
}
|
||||
|
||||
MIDIManager::~MIDIManager() {
|
||||
#ifdef HAVE_RTMIDI
|
||||
delete _midiInput;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef HAVE_RTMIDI
|
||||
const int DEFAULT_MIDI_PORT = 0;
|
||||
#endif
|
||||
|
||||
void MIDIManager::openDefaultPort() {
|
||||
#ifdef HAVE_RTMIDI
|
||||
if (!_midiInput) {
|
||||
_midiInput = new RtMidiIn();
|
||||
|
||||
if (_midiInput->getPortCount() > 0) {
|
||||
qCDebug(interfaceapp) << "MIDIManager opening port" << DEFAULT_MIDI_PORT;
|
||||
|
||||
_midiInput->openPort(DEFAULT_MIDI_PORT);
|
||||
|
||||
// don't ignore sysex, timing, or active sensing messages
|
||||
_midiInput->ignoreTypes(false, false, false);
|
||||
|
||||
_midiInput->setCallback(&MIDIManager::midiCallback);
|
||||
} else {
|
||||
qCDebug(interfaceapp) << "MIDIManager openDefaultPort called but there are no ports available.";
|
||||
delete _midiInput;
|
||||
_midiInput = NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
//
|
||||
// MIDIManager.h
|
||||
// interface/src/devices
|
||||
//
|
||||
// Created by Stephen Birarda on 2014-06-30.
|
||||
// Copyright 2014 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
|
||||
//
|
||||
|
||||
#ifndef hifi_MIDIManager_h
|
||||
#define hifi_MIDIManager_h
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtScript/QScriptEngine>
|
||||
|
||||
#include <MIDIEvent.h>
|
||||
|
||||
#ifdef HAVE_RTMIDI
|
||||
#include <RtMidi.h>
|
||||
#endif
|
||||
|
||||
class MIDIManager : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(unsigned int NoteOn READ NoteOn)
|
||||
Q_PROPERTY(unsigned int NoteOff READ NoteOff)
|
||||
Q_PROPERTY(unsigned int ModWheel READ ModWheel)
|
||||
Q_PROPERTY(unsigned int PitchWheel READ PitchWheel)
|
||||
|
||||
public:
|
||||
static MIDIManager& getInstance();
|
||||
static void midiCallback(double deltaTime, std::vector<unsigned char>* message, void* userData);
|
||||
|
||||
~MIDIManager();
|
||||
|
||||
void openDefaultPort();
|
||||
#ifdef HAVE_RTMIDI
|
||||
bool hasDevice() const { return !!_midiInput; }
|
||||
#endif
|
||||
public slots:
|
||||
unsigned int NoteOn() const { return 144; }
|
||||
unsigned int NoteOff() const { return 128; }
|
||||
unsigned int ModWheel() const { return 176; }
|
||||
unsigned int PitchWheel() const { return 224; }
|
||||
signals:
|
||||
void midiEvent(const MIDIEvent& event);
|
||||
|
||||
private:
|
||||
#ifdef HAVE_RTMIDI
|
||||
RtMidiIn* _midiInput;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
#endif // hifi_MIDIManager_h
|
||||
|
|
@ -1,259 +0,0 @@
|
|||
//
|
||||
// RealSense.cpp
|
||||
// interface/src/devices
|
||||
//
|
||||
// Created by Thijs Wenker on 12/10/14
|
||||
// Copyright 2014 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 "Application.h"
|
||||
#include "RealSense.h"
|
||||
#include "MainWindow.h"
|
||||
#include "Menu.h"
|
||||
#include "SharedUtil.h"
|
||||
|
||||
#ifdef HAVE_RSSDK
|
||||
const int PALMROOT_NUM_JOINTS = 3;
|
||||
const int FINGER_NUM_JOINTS = 4;
|
||||
#endif // HAVE_RSSDK
|
||||
|
||||
const DeviceTracker::Name RealSense::NAME = "RealSense";
|
||||
|
||||
// find the index of a joint from
|
||||
// the side: true = right
|
||||
// the finger & the bone:
|
||||
// finger in [0..4] : bone in [0..3] a finger phalange
|
||||
// [-1] up the hand branch : bone in [0..1] <=> [ hand, forearm]
|
||||
MotionTracker::Index evalRealSenseJointIndex(bool isRightSide, int finger, int bone) {
|
||||
#ifdef HAVE_RSSDK
|
||||
MotionTracker::Index offset = 1 // start after root
|
||||
+ (int(isRightSide) * PXCHandData::NUMBER_OF_JOINTS) // then offset for side
|
||||
+ PALMROOT_NUM_JOINTS; // then add the arm/forearm/hand chain
|
||||
if (finger >= 0) {
|
||||
// from there go down in the correct finger and bone
|
||||
return offset + (finger * FINGER_NUM_JOINTS) + bone;
|
||||
} else {
|
||||
// or go back up for the correct root bone
|
||||
return offset - 1 - bone;
|
||||
}
|
||||
#else
|
||||
return -1;
|
||||
#endif // HAVE_RSSDK
|
||||
}
|
||||
|
||||
// static
|
||||
void RealSense::init() {
|
||||
DeviceTracker* device = DeviceTracker::getDevice(NAME);
|
||||
if (!device) {
|
||||
// create a new RealSense and register it
|
||||
RealSense* realSense = new RealSense();
|
||||
DeviceTracker::registerDevice(NAME, realSense);
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void RealSense::destroy() {
|
||||
DeviceTracker::destroyDevice(NAME);
|
||||
}
|
||||
|
||||
// static
|
||||
RealSense* RealSense::getInstance() {
|
||||
DeviceTracker* device = DeviceTracker::getDevice(NAME);
|
||||
if (!device) {
|
||||
// create a new RealSense and register it
|
||||
RealSense* realSense = new RealSense();
|
||||
DeviceTracker::registerDevice(NAME, realSense);
|
||||
}
|
||||
return dynamic_cast< RealSense* > (device);
|
||||
}
|
||||
|
||||
RealSense::RealSense() :
|
||||
MotionTracker(),
|
||||
_active(false)
|
||||
{
|
||||
#ifdef HAVE_RSSDK
|
||||
_handData = NULL;
|
||||
_session = PXCSession_Create();
|
||||
initSession(false, NULL);
|
||||
|
||||
// Create the RealSense joint hierarchy
|
||||
std::vector< Semantic > sides;
|
||||
sides.push_back("joint_L_");
|
||||
sides.push_back("joint_R_");
|
||||
|
||||
std::vector< Semantic > rootBones;
|
||||
rootBones.push_back("wrist");
|
||||
rootBones.push_back("hand");
|
||||
|
||||
std::vector< Semantic > fingers;
|
||||
fingers.push_back("thumb");
|
||||
fingers.push_back("index");
|
||||
fingers.push_back("middle");
|
||||
fingers.push_back("ring");
|
||||
fingers.push_back("pinky");
|
||||
|
||||
std::vector< Semantic > fingerBones;
|
||||
fingerBones.push_back("1");
|
||||
fingerBones.push_back("2");
|
||||
fingerBones.push_back("3");
|
||||
fingerBones.push_back("4");
|
||||
|
||||
std::vector< Index > palms;
|
||||
for (unsigned int s = 0; s < sides.size(); s++) {
|
||||
Index rootJoint = 0;
|
||||
for (unsigned int rb = 0; rb < rootBones.size(); rb++) {
|
||||
rootJoint = addJoint(sides[s] + rootBones[rb], rootJoint);
|
||||
}
|
||||
|
||||
// capture the hand index for debug
|
||||
palms.push_back(rootJoint);
|
||||
|
||||
for (unsigned int f = 0; f < fingers.size(); f++) {
|
||||
for (unsigned int b = 0; b < fingerBones.size(); b++) {
|
||||
rootJoint = addJoint(sides[s] + fingers[f] + fingerBones[b], rootJoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // HAVE_RSSDK
|
||||
}
|
||||
|
||||
RealSense::~RealSense() {
|
||||
#ifdef HAVE_RSSDK
|
||||
_manager->Release();
|
||||
#endif // HAVE_RSSDK
|
||||
}
|
||||
|
||||
void RealSense::initSession(bool playback, QString filename) {
|
||||
#ifdef HAVE_RSSDK
|
||||
_active = false;
|
||||
_properlyInitialized = false;
|
||||
if (_handData != NULL) {
|
||||
_handData->Release();
|
||||
_handController->Release();
|
||||
_session->Release();
|
||||
_config->Release();
|
||||
}
|
||||
_manager = _session->CreateSenseManager();
|
||||
if (playback) {
|
||||
_manager->QueryCaptureManager()->SetFileName(filename.toStdWString().c_str(), false);
|
||||
}
|
||||
_manager->QueryCaptureManager()->SetRealtime(!playback);
|
||||
_manager->EnableHand(0);
|
||||
_handController = _manager->QueryHand();
|
||||
|
||||
if (_manager->Init() == PXC_STATUS_NO_ERROR) {
|
||||
_handData = _handController->CreateOutput();
|
||||
|
||||
PXCCapture::Device *device = _manager->QueryCaptureManager()->QueryDevice();
|
||||
PXCCapture::DeviceInfo dinfo;
|
||||
_manager->QueryCaptureManager()->QueryDevice()->QueryDeviceInfo(&dinfo);
|
||||
if (dinfo.model == PXCCapture::DEVICE_MODEL_IVCAM)
|
||||
{
|
||||
device->SetDepthConfidenceThreshold(1);
|
||||
device->SetMirrorMode(PXCCapture::Device::MIRROR_MODE_DISABLED);
|
||||
device->SetIVCAMFilterOption(6);
|
||||
}
|
||||
_properlyInitialized = true;
|
||||
}
|
||||
|
||||
_config = _handController->CreateActiveConfiguration();
|
||||
_config->EnableStabilizer(true);
|
||||
_config->SetTrackingMode(PXCHandData::TRACKING_MODE_FULL_HAND);
|
||||
_config->ApplyChanges();
|
||||
#endif // HAVE_RSSDK
|
||||
}
|
||||
|
||||
#ifdef HAVE_RSSDK
|
||||
glm::quat quatFromPXCPoint4DF32(const PXCPoint4DF32& basis) {
|
||||
return glm::normalize(glm::quat(basis.w, basis.x, basis.y, basis.z) * glm::quat(glm::vec3(0, M_PI, 0)));
|
||||
}
|
||||
|
||||
glm::vec3 vec3FromPXCPoint3DF32(const PXCPoint3DF32& vec) {
|
||||
return glm::vec3(-vec.x, vec.y, -vec.z);
|
||||
}
|
||||
#endif // HAVE_RSSDK
|
||||
|
||||
void RealSense::update() {
|
||||
#ifdef HAVE_RSSDK
|
||||
bool wasActive = _active;
|
||||
_active = _manager->IsConnected() && _properlyInitialized;
|
||||
if (_active || wasActive) {
|
||||
// Go through all the joints and increment their counter since last update.
|
||||
// Increment all counters once after controller first becomes inactive so that each joint reports itself as inactive.
|
||||
// TODO C++11 for (auto jointIt = _jointsArray.begin(); jointIt != _jointsArray.end(); jointIt++) {
|
||||
for (JointTracker::Vector::iterator jointIt = _jointsArray.begin(); jointIt != _jointsArray.end(); jointIt++) {
|
||||
(*jointIt).tickNewFrame();
|
||||
}
|
||||
}
|
||||
|
||||
if (!_active) {
|
||||
return;
|
||||
}
|
||||
|
||||
pxcStatus sts = _manager->AcquireFrame(true);
|
||||
_handData->Update();
|
||||
PXCHandData::JointData nodes[2][PXCHandData::NUMBER_OF_JOINTS] = {};
|
||||
PXCHandData::ExtremityData extremitiesPointsNodes[2][PXCHandData::NUMBER_OF_EXTREMITIES] = {};
|
||||
for (pxcI32 i = 0; i < _handData->QueryNumberOfHands(); i++) {
|
||||
PXCHandData::IHand* handData;
|
||||
if (_handData->QueryHandData(PXCHandData::ACCESS_ORDER_BY_TIME, i, handData) == PXC_STATUS_NO_ERROR) {
|
||||
int rightSide = handData->QueryBodySide() == PXCHandData::BODY_SIDE_RIGHT;
|
||||
PXCHandData::JointData jointData;
|
||||
JointTracker* parentJointTracker = _jointsArray.data();
|
||||
//Iterate Joints
|
||||
int rootBranchIndex = -1;
|
||||
JointTracker* palmJoint = NULL;
|
||||
for (int j = 0; j < PXCHandData::NUMBER_OF_JOINTS; j++) {
|
||||
handData->QueryTrackedJoint((PXCHandData::JointType)j, jointData);
|
||||
nodes[i][j] = jointData;
|
||||
if (j == PXCHandData::JOINT_WRIST) {
|
||||
JointTracker* wrist = editJointTracker(evalRealSenseJointIndex(rightSide, rootBranchIndex, 1)); // 1 is the index of the wrist joint
|
||||
wrist->editAbsFrame().setTranslation(vec3FromPXCPoint3DF32(jointData.positionWorld));
|
||||
wrist->editAbsFrame().setRotation(quatFromPXCPoint4DF32(jointData.globalOrientation));
|
||||
wrist->updateLocFromAbsTransform(parentJointTracker);
|
||||
wrist->activeFrame();
|
||||
parentJointTracker = wrist;
|
||||
continue;
|
||||
} else if (j == PXCHandData::JOINT_CENTER) {
|
||||
palmJoint = editJointTracker(evalRealSenseJointIndex(rightSide, rootBranchIndex, 0)); // 0 is the index of the palm joint
|
||||
palmJoint->editAbsFrame().setTranslation(vec3FromPXCPoint3DF32(jointData.positionWorld));
|
||||
palmJoint->editAbsFrame().setRotation(quatFromPXCPoint4DF32(jointData.globalOrientation));
|
||||
palmJoint->updateLocFromAbsTransform(parentJointTracker);
|
||||
palmJoint->activeFrame();
|
||||
parentJointTracker = palmJoint;
|
||||
continue;
|
||||
}
|
||||
int finger_index = j - PALMROOT_NUM_JOINTS;
|
||||
int finger = finger_index / FINGER_NUM_JOINTS;
|
||||
int finger_bone = finger_index % FINGER_NUM_JOINTS;
|
||||
JointTracker* ljointTracker = editJointTracker(evalRealSenseJointIndex(rightSide, finger, finger_bone));
|
||||
if (jointData.confidence > 0) {
|
||||
ljointTracker->editAbsFrame().setTranslation(vec3FromPXCPoint3DF32(jointData.positionWorld));
|
||||
ljointTracker->editAbsFrame().setRotation(quatFromPXCPoint4DF32(jointData.globalOrientation));
|
||||
ljointTracker->updateLocFromAbsTransform(parentJointTracker);
|
||||
ljointTracker->activeFrame();
|
||||
}
|
||||
if (finger_bone == (FINGER_NUM_JOINTS - 1)) {
|
||||
parentJointTracker = palmJoint;
|
||||
continue;
|
||||
}
|
||||
parentJointTracker = ljointTracker;
|
||||
}
|
||||
}
|
||||
}
|
||||
_manager->ReleaseFrame();
|
||||
#endif // HAVE_RSSDK
|
||||
}
|
||||
|
||||
void RealSense::loadRSSDKFile() {
|
||||
QString locationDir(QStandardPaths::displayName(QStandardPaths::DesktopLocation));
|
||||
QString fileNameString = QFileDialog::getOpenFileName(qApp->getWindow(), tr("Open RSSDK clip"),
|
||||
locationDir,
|
||||
tr("RSSDK Recordings (*.rssdk)"));
|
||||
if (!fileNameString.isEmpty()) {
|
||||
initSession(true, fileNameString);
|
||||
}
|
||||
}
|
|
@ -1,65 +0,0 @@
|
|||
//
|
||||
// RealSense.h
|
||||
// interface/src/devices
|
||||
//
|
||||
// Created by Thijs Wenker on 12/10/14
|
||||
// Copyright 2014 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
|
||||
//
|
||||
|
||||
#ifndef hifi_RealSense_h
|
||||
#define hifi_RealSense_h
|
||||
|
||||
#include <QFileDialog>
|
||||
|
||||
#include "MotionTracker.h"
|
||||
|
||||
#ifdef HAVE_RSSDK
|
||||
#include <pxcsession.h>
|
||||
#include <pxchandmodule.h>
|
||||
#include <pxchandconfiguration.h>
|
||||
#include <pxcsensemanager.h>
|
||||
#include <pxchanddata.h>
|
||||
#endif
|
||||
|
||||
/// Handles interaction with the RealSense skeleton tracking suit.
|
||||
class RealSense : public QObject, public MotionTracker {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static const Name NAME;
|
||||
|
||||
static void init();
|
||||
static void destroy();
|
||||
|
||||
/// RealSense MotionTracker factory
|
||||
static RealSense* getInstance();
|
||||
|
||||
bool isActive() const { return _active; }
|
||||
|
||||
virtual void update();
|
||||
|
||||
public slots:
|
||||
void loadRSSDKFile();
|
||||
|
||||
protected:
|
||||
RealSense();
|
||||
virtual ~RealSense();
|
||||
|
||||
void initSession(bool playback, QString filename);
|
||||
|
||||
private:
|
||||
#ifdef HAVE_RSSDK
|
||||
PXCSession* _session;
|
||||
PXCSenseManager* _manager;
|
||||
PXCHandModule* _handController;
|
||||
PXCHandData* _handData;
|
||||
PXCHandConfiguration* _config;
|
||||
#endif
|
||||
bool _properlyInitialized;
|
||||
bool _active;
|
||||
};
|
||||
|
||||
#endif // hifi_RealSense_h
|
|
@ -80,9 +80,9 @@ void Batch::clear() {
|
|||
_framebuffers.clear();
|
||||
}
|
||||
|
||||
uint32 Batch::cacheData(uint32 size, const void* data) {
|
||||
uint32 offset = _data.size();
|
||||
uint32 numBytes = size;
|
||||
size_t Batch::cacheData(size_t size, const void* data) {
|
||||
size_t offset = _data.size();
|
||||
size_t numBytes = size;
|
||||
_data.resize(offset + numBytes);
|
||||
memcpy(_data.data() + offset, data, size);
|
||||
|
||||
|
|
|
@ -334,7 +334,7 @@ public:
|
|||
NUM_COMMANDS,
|
||||
};
|
||||
typedef std::vector<Command> Commands;
|
||||
typedef std::vector<uint32> CommandOffsets;
|
||||
typedef std::vector<size_t> CommandOffsets;
|
||||
|
||||
const Commands& getCommands() const { return _commands; }
|
||||
const CommandOffsets& getCommandOffsets() const { return _commandOffsets; }
|
||||
|
@ -342,11 +342,17 @@ public:
|
|||
class Param {
|
||||
public:
|
||||
union {
|
||||
#if (QT_POINTER_SIZE == 8)
|
||||
size_t _size;
|
||||
#endif
|
||||
int32 _int;
|
||||
uint32 _uint;
|
||||
float _float;
|
||||
char _chars[4];
|
||||
char _chars[sizeof(size_t)];
|
||||
};
|
||||
#if (QT_POINTER_SIZE == 8)
|
||||
Param(size_t val) : _size(val) {}
|
||||
#endif
|
||||
Param(int32 val) : _int(val) {}
|
||||
Param(uint32 val) : _uint(val) {}
|
||||
Param(float val) : _float(val) {}
|
||||
|
@ -370,8 +376,8 @@ public:
|
|||
std::vector< Cache<T> > _items;
|
||||
|
||||
size_t size() const { return _items.size(); }
|
||||
uint32 cache(const Data& data) {
|
||||
uint32 offset = _items.size();
|
||||
size_t cache(const Data& data) {
|
||||
size_t offset = _items.size();
|
||||
_items.push_back(Cache<T>(data));
|
||||
return offset;
|
||||
}
|
||||
|
@ -403,8 +409,8 @@ public:
|
|||
// FOr example Mat4s are going there
|
||||
typedef unsigned char Byte;
|
||||
typedef std::vector<Byte> Bytes;
|
||||
uint32 cacheData(uint32 size, const void* data);
|
||||
Byte* editData(uint32 offset) {
|
||||
size_t cacheData(size_t size, const void* data);
|
||||
Byte* editData(size_t offset) {
|
||||
if (offset >= _data.size()) {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ typedef char int8;
|
|||
|
||||
typedef unsigned char Byte;
|
||||
|
||||
typedef uint32 Offset;
|
||||
typedef size_t Offset;
|
||||
|
||||
typedef glm::mat4 Mat4;
|
||||
typedef glm::mat3 Mat3;
|
||||
|
|
|
@ -304,7 +304,7 @@ void GLBackend::syncCache() {
|
|||
glEnable(GL_LINE_SMOOTH);
|
||||
}
|
||||
|
||||
void GLBackend::do_draw(Batch& batch, uint32 paramOffset) {
|
||||
void GLBackend::do_draw(Batch& batch, size_t paramOffset) {
|
||||
updateInput();
|
||||
updateTransform();
|
||||
updatePipeline();
|
||||
|
@ -317,7 +317,7 @@ void GLBackend::do_draw(Batch& batch, uint32 paramOffset) {
|
|||
(void) CHECK_GL_ERROR();
|
||||
}
|
||||
|
||||
void GLBackend::do_drawIndexed(Batch& batch, uint32 paramOffset) {
|
||||
void GLBackend::do_drawIndexed(Batch& batch, size_t paramOffset) {
|
||||
updateInput();
|
||||
updateTransform();
|
||||
updatePipeline();
|
||||
|
@ -336,7 +336,7 @@ void GLBackend::do_drawIndexed(Batch& batch, uint32 paramOffset) {
|
|||
(void) CHECK_GL_ERROR();
|
||||
}
|
||||
|
||||
void GLBackend::do_drawInstanced(Batch& batch, uint32 paramOffset) {
|
||||
void GLBackend::do_drawInstanced(Batch& batch, size_t paramOffset) {
|
||||
updateInput();
|
||||
updateTransform();
|
||||
updatePipeline();
|
||||
|
@ -351,7 +351,7 @@ void GLBackend::do_drawInstanced(Batch& batch, uint32 paramOffset) {
|
|||
(void) CHECK_GL_ERROR();
|
||||
}
|
||||
|
||||
void GLBackend::do_drawIndexedInstanced(Batch& batch, uint32 paramOffset) {
|
||||
void GLBackend::do_drawIndexedInstanced(Batch& batch, size_t paramOffset) {
|
||||
updateInput();
|
||||
updateTransform();
|
||||
updatePipeline();
|
||||
|
@ -378,7 +378,7 @@ void GLBackend::do_drawIndexedInstanced(Batch& batch, uint32 paramOffset) {
|
|||
}
|
||||
|
||||
|
||||
void GLBackend::do_multiDrawIndirect(Batch& batch, uint32 paramOffset) {
|
||||
void GLBackend::do_multiDrawIndirect(Batch& batch, size_t paramOffset) {
|
||||
#if (GPU_INPUT_PROFILE == GPU_CORE_43)
|
||||
updateInput();
|
||||
updateTransform();
|
||||
|
@ -387,7 +387,7 @@ void GLBackend::do_multiDrawIndirect(Batch& batch, uint32 paramOffset) {
|
|||
uint commandCount = batch._params[paramOffset + 0]._uint;
|
||||
GLenum mode = _primitiveToGLmode[(Primitive)batch._params[paramOffset + 1]._uint];
|
||||
|
||||
glMultiDrawArraysIndirect(mode, reinterpret_cast<GLvoid*>(_input._indirectBufferOffset), commandCount, _input._indirectBufferStride);
|
||||
glMultiDrawArraysIndirect(mode, reinterpret_cast<GLvoid*>(_input._indirectBufferOffset), commandCount, (GLsizei)_input._indirectBufferStride);
|
||||
#else
|
||||
// FIXME implement the slow path
|
||||
#endif
|
||||
|
@ -395,7 +395,7 @@ void GLBackend::do_multiDrawIndirect(Batch& batch, uint32 paramOffset) {
|
|||
|
||||
}
|
||||
|
||||
void GLBackend::do_multiDrawIndexedIndirect(Batch& batch, uint32 paramOffset) {
|
||||
void GLBackend::do_multiDrawIndexedIndirect(Batch& batch, size_t paramOffset) {
|
||||
#if (GPU_INPUT_PROFILE == GPU_CORE_43)
|
||||
updateInput();
|
||||
updateTransform();
|
||||
|
@ -405,7 +405,7 @@ void GLBackend::do_multiDrawIndexedIndirect(Batch& batch, uint32 paramOffset) {
|
|||
GLenum mode = _primitiveToGLmode[(Primitive)batch._params[paramOffset + 1]._uint];
|
||||
GLenum indexType = _elementTypeToGLType[_input._indexBufferType];
|
||||
|
||||
glMultiDrawElementsIndirect(mode, indexType, reinterpret_cast<GLvoid*>(_input._indirectBufferOffset), commandCount, _input._indirectBufferStride);
|
||||
glMultiDrawElementsIndirect(mode, indexType, reinterpret_cast<GLvoid*>(_input._indirectBufferOffset), commandCount, (GLsizei)_input._indirectBufferStride);
|
||||
#else
|
||||
// FIXME implement the slow path
|
||||
#endif
|
||||
|
@ -413,11 +413,11 @@ void GLBackend::do_multiDrawIndexedIndirect(Batch& batch, uint32 paramOffset) {
|
|||
}
|
||||
|
||||
|
||||
void GLBackend::do_resetStages(Batch& batch, uint32 paramOffset) {
|
||||
void GLBackend::do_resetStages(Batch& batch, size_t paramOffset) {
|
||||
resetStages();
|
||||
}
|
||||
|
||||
void GLBackend::do_runLambda(Batch& batch, uint32 paramOffset) {
|
||||
void GLBackend::do_runLambda(Batch& batch, size_t paramOffset) {
|
||||
std::function<void()> f = batch._lambdas.get(batch._params[paramOffset]._uint);
|
||||
f();
|
||||
}
|
||||
|
@ -455,7 +455,7 @@ void Batch::_glActiveBindTexture(GLenum unit, GLenum target, GLuint texture) {
|
|||
|
||||
DO_IT_NOW(_glActiveBindTexture, 3);
|
||||
}
|
||||
void GLBackend::do_glActiveBindTexture(Batch& batch, uint32 paramOffset) {
|
||||
void GLBackend::do_glActiveBindTexture(Batch& batch, size_t paramOffset) {
|
||||
glActiveTexture(batch._params[paramOffset + 2]._uint);
|
||||
glBindTexture(
|
||||
batch._params[paramOffset + 1]._uint,
|
||||
|
@ -474,7 +474,7 @@ void Batch::_glUniform1i(GLint location, GLint v0) {
|
|||
|
||||
DO_IT_NOW(_glUniform1i, 1);
|
||||
}
|
||||
void GLBackend::do_glUniform1i(Batch& batch, uint32 paramOffset) {
|
||||
void GLBackend::do_glUniform1i(Batch& batch, size_t paramOffset) {
|
||||
if (_pipeline._program == 0) {
|
||||
// We should call updatePipeline() to bind the program but we are not doing that
|
||||
// because these uniform setters are deprecated and we don;t want to create side effect
|
||||
|
@ -497,7 +497,7 @@ void Batch::_glUniform1f(GLint location, GLfloat v0) {
|
|||
|
||||
DO_IT_NOW(_glUniform1f, 1);
|
||||
}
|
||||
void GLBackend::do_glUniform1f(Batch& batch, uint32 paramOffset) {
|
||||
void GLBackend::do_glUniform1f(Batch& batch, size_t paramOffset) {
|
||||
if (_pipeline._program == 0) {
|
||||
// We should call updatePipeline() to bind the program but we are not doing that
|
||||
// because these uniform setters are deprecated and we don;t want to create side effect
|
||||
|
@ -521,7 +521,7 @@ void Batch::_glUniform2f(GLint location, GLfloat v0, GLfloat v1) {
|
|||
DO_IT_NOW(_glUniform2f, 1);
|
||||
}
|
||||
|
||||
void GLBackend::do_glUniform2f(Batch& batch, uint32 paramOffset) {
|
||||
void GLBackend::do_glUniform2f(Batch& batch, size_t paramOffset) {
|
||||
if (_pipeline._program == 0) {
|
||||
// We should call updatePipeline() to bind the program but we are not doing that
|
||||
// because these uniform setters are deprecated and we don;t want to create side effect
|
||||
|
@ -546,7 +546,7 @@ void Batch::_glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2) {
|
|||
DO_IT_NOW(_glUniform3f, 1);
|
||||
}
|
||||
|
||||
void GLBackend::do_glUniform3f(Batch& batch, uint32 paramOffset) {
|
||||
void GLBackend::do_glUniform3f(Batch& batch, size_t paramOffset) {
|
||||
if (_pipeline._program == 0) {
|
||||
// We should call updatePipeline() to bind the program but we are not doing that
|
||||
// because these uniform setters are deprecated and we don;t want to create side effect
|
||||
|
@ -575,7 +575,7 @@ void Batch::_glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLf
|
|||
}
|
||||
|
||||
|
||||
void GLBackend::do_glUniform4f(Batch& batch, uint32 paramOffset) {
|
||||
void GLBackend::do_glUniform4f(Batch& batch, size_t paramOffset) {
|
||||
if (_pipeline._program == 0) {
|
||||
// We should call updatePipeline() to bind the program but we are not doing that
|
||||
// because these uniform setters are deprecated and we don;t want to create side effect
|
||||
|
@ -601,7 +601,7 @@ void Batch::_glUniform3fv(GLint location, GLsizei count, const GLfloat* value) {
|
|||
|
||||
DO_IT_NOW(_glUniform3fv, 3);
|
||||
}
|
||||
void GLBackend::do_glUniform3fv(Batch& batch, uint32 paramOffset) {
|
||||
void GLBackend::do_glUniform3fv(Batch& batch, size_t paramOffset) {
|
||||
if (_pipeline._program == 0) {
|
||||
// We should call updatePipeline() to bind the program but we are not doing that
|
||||
// because these uniform setters are deprecated and we don;t want to create side effect
|
||||
|
@ -627,7 +627,7 @@ void Batch::_glUniform4fv(GLint location, GLsizei count, const GLfloat* value) {
|
|||
|
||||
DO_IT_NOW(_glUniform4fv, 3);
|
||||
}
|
||||
void GLBackend::do_glUniform4fv(Batch& batch, uint32 paramOffset) {
|
||||
void GLBackend::do_glUniform4fv(Batch& batch, size_t paramOffset) {
|
||||
if (_pipeline._program == 0) {
|
||||
// We should call updatePipeline() to bind the program but we are not doing that
|
||||
// because these uniform setters are deprecated and we don;t want to create side effect
|
||||
|
@ -653,7 +653,7 @@ void Batch::_glUniform4iv(GLint location, GLsizei count, const GLint* value) {
|
|||
|
||||
DO_IT_NOW(_glUniform4iv, 3);
|
||||
}
|
||||
void GLBackend::do_glUniform4iv(Batch& batch, uint32 paramOffset) {
|
||||
void GLBackend::do_glUniform4iv(Batch& batch, size_t paramOffset) {
|
||||
if (_pipeline._program == 0) {
|
||||
// We should call updatePipeline() to bind the program but we are not doing that
|
||||
// because these uniform setters are deprecated and we don;t want to create side effect
|
||||
|
@ -679,7 +679,7 @@ void Batch::_glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpo
|
|||
|
||||
DO_IT_NOW(_glUniformMatrix4fv, 4);
|
||||
}
|
||||
void GLBackend::do_glUniformMatrix4fv(Batch& batch, uint32 paramOffset) {
|
||||
void GLBackend::do_glUniformMatrix4fv(Batch& batch, size_t paramOffset) {
|
||||
if (_pipeline._program == 0) {
|
||||
// We should call updatePipeline() to bind the program but we are not doing that
|
||||
// because these uniform setters are deprecated and we don;t want to create side effect
|
||||
|
@ -704,7 +704,7 @@ void Batch::_glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
|
|||
|
||||
DO_IT_NOW(_glColor4f, 4);
|
||||
}
|
||||
void GLBackend::do_glColor4f(Batch& batch, uint32 paramOffset) {
|
||||
void GLBackend::do_glColor4f(Batch& batch, size_t paramOffset) {
|
||||
|
||||
glm::vec4 newColor(
|
||||
batch._params[paramOffset + 3]._float,
|
||||
|
@ -720,14 +720,14 @@ void GLBackend::do_glColor4f(Batch& batch, uint32 paramOffset) {
|
|||
}
|
||||
|
||||
|
||||
void GLBackend::do_pushProfileRange(Batch& batch, uint32 paramOffset) {
|
||||
void GLBackend::do_pushProfileRange(Batch& batch, size_t paramOffset) {
|
||||
#if defined(NSIGHT_FOUND)
|
||||
auto name = batch._profileRanges.get(batch._params[paramOffset]._uint);
|
||||
nvtxRangePush(name.c_str());
|
||||
#endif
|
||||
}
|
||||
|
||||
void GLBackend::do_popProfileRange(Batch& batch, uint32 paramOffset) {
|
||||
void GLBackend::do_popProfileRange(Batch& batch, size_t paramOffset) {
|
||||
#if defined(NSIGHT_FOUND)
|
||||
nvtxRangePop();
|
||||
#endif
|
||||
|
|
|
@ -195,17 +195,17 @@ public:
|
|||
static const int MAX_NUM_ATTRIBUTES = Stream::NUM_INPUT_SLOTS;
|
||||
static const int MAX_NUM_INPUT_BUFFERS = 16;
|
||||
|
||||
uint32 getNumInputBuffers() const { return _input._invalidBuffers.size(); }
|
||||
size_t getNumInputBuffers() const { return _input._invalidBuffers.size(); }
|
||||
|
||||
// this is the maximum per shader stage on the low end apple
|
||||
// TODO make it platform dependant at init time
|
||||
static const int MAX_NUM_UNIFORM_BUFFERS = 12;
|
||||
uint32 getMaxNumUniformBuffers() const { return MAX_NUM_UNIFORM_BUFFERS; }
|
||||
size_t getMaxNumUniformBuffers() const { return MAX_NUM_UNIFORM_BUFFERS; }
|
||||
|
||||
// this is the maximum per shader stage on the low end apple
|
||||
// TODO make it platform dependant at init time
|
||||
static const int MAX_NUM_RESOURCE_TEXTURES = 16;
|
||||
uint32 getMaxNumResourceTextures() const { return MAX_NUM_RESOURCE_TEXTURES; }
|
||||
size_t getMaxNumResourceTextures() const { return MAX_NUM_RESOURCE_TEXTURES; }
|
||||
|
||||
// The State setters called by the GLState::Commands when a new state is assigned
|
||||
void do_setStateFillMode(int32 mode);
|
||||
|
@ -248,18 +248,18 @@ protected:
|
|||
Stats _stats;
|
||||
|
||||
// Draw Stage
|
||||
void do_draw(Batch& batch, uint32 paramOffset);
|
||||
void do_drawIndexed(Batch& batch, uint32 paramOffset);
|
||||
void do_drawInstanced(Batch& batch, uint32 paramOffset);
|
||||
void do_drawIndexedInstanced(Batch& batch, uint32 paramOffset);
|
||||
void do_multiDrawIndirect(Batch& batch, uint32 paramOffset);
|
||||
void do_multiDrawIndexedIndirect(Batch& batch, uint32 paramOffset);
|
||||
void do_draw(Batch& batch, size_t paramOffset);
|
||||
void do_drawIndexed(Batch& batch, size_t paramOffset);
|
||||
void do_drawInstanced(Batch& batch, size_t paramOffset);
|
||||
void do_drawIndexedInstanced(Batch& batch, size_t paramOffset);
|
||||
void do_multiDrawIndirect(Batch& batch, size_t paramOffset);
|
||||
void do_multiDrawIndexedIndirect(Batch& batch, size_t paramOffset);
|
||||
|
||||
// Input Stage
|
||||
void do_setInputFormat(Batch& batch, uint32 paramOffset);
|
||||
void do_setInputBuffer(Batch& batch, uint32 paramOffset);
|
||||
void do_setIndexBuffer(Batch& batch, uint32 paramOffset);
|
||||
void do_setIndirectBuffer(Batch& batch, uint32 paramOffset);
|
||||
void do_setInputFormat(Batch& batch, size_t paramOffset);
|
||||
void do_setInputBuffer(Batch& batch, size_t paramOffset);
|
||||
void do_setIndexBuffer(Batch& batch, size_t paramOffset);
|
||||
void do_setIndirectBuffer(Batch& batch, size_t paramOffset);
|
||||
|
||||
void initInput();
|
||||
void killInput();
|
||||
|
@ -310,11 +310,11 @@ protected:
|
|||
} _input;
|
||||
|
||||
// Transform Stage
|
||||
void do_setModelTransform(Batch& batch, uint32 paramOffset);
|
||||
void do_setViewTransform(Batch& batch, uint32 paramOffset);
|
||||
void do_setProjectionTransform(Batch& batch, uint32 paramOffset);
|
||||
void do_setViewportTransform(Batch& batch, uint32 paramOffset);
|
||||
void do_setDepthRangeTransform(Batch& batch, uint32 paramOffset);
|
||||
void do_setModelTransform(Batch& batch, size_t paramOffset);
|
||||
void do_setViewTransform(Batch& batch, size_t paramOffset);
|
||||
void do_setProjectionTransform(Batch& batch, size_t paramOffset);
|
||||
void do_setViewportTransform(Batch& batch, size_t paramOffset);
|
||||
void do_setDepthRangeTransform(Batch& batch, size_t paramOffset);
|
||||
|
||||
void initTransform();
|
||||
void killTransform();
|
||||
|
@ -362,7 +362,7 @@ protected:
|
|||
|
||||
|
||||
// Uniform Stage
|
||||
void do_setUniformBuffer(Batch& batch, uint32 paramOffset);
|
||||
void do_setUniformBuffer(Batch& batch, size_t paramOffset);
|
||||
|
||||
void releaseUniformBuffer(uint32_t slot);
|
||||
void resetUniformStage();
|
||||
|
@ -375,7 +375,7 @@ protected:
|
|||
} _uniform;
|
||||
|
||||
// Resource Stage
|
||||
void do_setResourceTexture(Batch& batch, uint32 paramOffset);
|
||||
void do_setResourceTexture(Batch& batch, size_t paramOffset);
|
||||
|
||||
void releaseResourceTexture(uint32_t slot);
|
||||
void resetResourceStage();
|
||||
|
@ -390,9 +390,9 @@ protected:
|
|||
size_t _commandIndex{ 0 };
|
||||
|
||||
// Pipeline Stage
|
||||
void do_setPipeline(Batch& batch, uint32 paramOffset);
|
||||
void do_setStateBlendFactor(Batch& batch, uint32 paramOffset);
|
||||
void do_setStateScissorRect(Batch& batch, uint32 paramOffset);
|
||||
void do_setPipeline(Batch& batch, size_t paramOffset);
|
||||
void do_setStateBlendFactor(Batch& batch, size_t paramOffset);
|
||||
void do_setStateScissorRect(Batch& batch, size_t paramOffset);
|
||||
|
||||
// Standard update pipeline check that the current Program and current State or good to go for a
|
||||
void updatePipeline();
|
||||
|
@ -429,9 +429,9 @@ protected:
|
|||
} _pipeline;
|
||||
|
||||
// Output stage
|
||||
void do_setFramebuffer(Batch& batch, uint32 paramOffset);
|
||||
void do_clearFramebuffer(Batch& batch, uint32 paramOffset);
|
||||
void do_blit(Batch& batch, uint32 paramOffset);
|
||||
void do_setFramebuffer(Batch& batch, size_t paramOffset);
|
||||
void do_clearFramebuffer(Batch& batch, size_t paramOffset);
|
||||
void do_blit(Batch& batch, size_t paramOffset);
|
||||
|
||||
// Synchronize the state cache of this Backend with the actual real state of the GL Context
|
||||
void syncOutputStateCache();
|
||||
|
@ -446,9 +446,9 @@ protected:
|
|||
} _output;
|
||||
|
||||
// Query section
|
||||
void do_beginQuery(Batch& batch, uint32 paramOffset);
|
||||
void do_endQuery(Batch& batch, uint32 paramOffset);
|
||||
void do_getQuery(Batch& batch, uint32 paramOffset);
|
||||
void do_beginQuery(Batch& batch, size_t paramOffset);
|
||||
void do_endQuery(Batch& batch, size_t paramOffset);
|
||||
void do_getQuery(Batch& batch, size_t paramOffset);
|
||||
|
||||
void resetQueryStage();
|
||||
struct QueryStageState {
|
||||
|
@ -456,33 +456,33 @@ protected:
|
|||
};
|
||||
|
||||
// Reset stages
|
||||
void do_resetStages(Batch& batch, uint32 paramOffset);
|
||||
void do_resetStages(Batch& batch, size_t paramOffset);
|
||||
|
||||
void do_runLambda(Batch& batch, uint32 paramOffset);
|
||||
void do_runLambda(Batch& batch, size_t paramOffset);
|
||||
|
||||
void resetStages();
|
||||
|
||||
// TODO: As long as we have gl calls explicitely issued from interface
|
||||
// code, we need to be able to record and batch these calls. THe long
|
||||
// term strategy is to get rid of any GL calls in favor of the HIFI GPU API
|
||||
void do_glActiveBindTexture(Batch& batch, uint32 paramOffset);
|
||||
void do_glActiveBindTexture(Batch& batch, size_t paramOffset);
|
||||
|
||||
void do_glUniform1i(Batch& batch, uint32 paramOffset);
|
||||
void do_glUniform1f(Batch& batch, uint32 paramOffset);
|
||||
void do_glUniform2f(Batch& batch, uint32 paramOffset);
|
||||
void do_glUniform3f(Batch& batch, uint32 paramOffset);
|
||||
void do_glUniform4f(Batch& batch, uint32 paramOffset);
|
||||
void do_glUniform3fv(Batch& batch, uint32 paramOffset);
|
||||
void do_glUniform4fv(Batch& batch, uint32 paramOffset);
|
||||
void do_glUniform4iv(Batch& batch, uint32 paramOffset);
|
||||
void do_glUniformMatrix4fv(Batch& batch, uint32 paramOffset);
|
||||
void do_glUniform1i(Batch& batch, size_t paramOffset);
|
||||
void do_glUniform1f(Batch& batch, size_t paramOffset);
|
||||
void do_glUniform2f(Batch& batch, size_t paramOffset);
|
||||
void do_glUniform3f(Batch& batch, size_t paramOffset);
|
||||
void do_glUniform4f(Batch& batch, size_t paramOffset);
|
||||
void do_glUniform3fv(Batch& batch, size_t paramOffset);
|
||||
void do_glUniform4fv(Batch& batch, size_t paramOffset);
|
||||
void do_glUniform4iv(Batch& batch, size_t paramOffset);
|
||||
void do_glUniformMatrix4fv(Batch& batch, size_t paramOffset);
|
||||
|
||||
void do_glColor4f(Batch& batch, uint32 paramOffset);
|
||||
void do_glColor4f(Batch& batch, size_t paramOffset);
|
||||
|
||||
void do_pushProfileRange(Batch& batch, uint32 paramOffset);
|
||||
void do_popProfileRange(Batch& batch, uint32 paramOffset);
|
||||
void do_pushProfileRange(Batch& batch, size_t paramOffset);
|
||||
void do_popProfileRange(Batch& batch, size_t paramOffset);
|
||||
|
||||
typedef void (GLBackend::*CommandCall)(Batch&, uint32);
|
||||
typedef void (GLBackend::*CommandCall)(Batch&, size_t);
|
||||
static CommandCall _commandCalls[Batch::NUM_COMMANDS];
|
||||
};
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ GLBackend::GLBuffer* GLBackend::syncGPUObject(const Buffer& buffer) {
|
|||
glBufferData(GL_ARRAY_BUFFER, buffer.getSysmem().getSize(), buffer.getSysmem().readData(), GL_DYNAMIC_DRAW);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
object->_stamp = buffer.getSysmem().getStamp();
|
||||
object->_size = buffer.getSysmem().getSize();
|
||||
object->_size = (GLuint)buffer.getSysmem().getSize();
|
||||
//}
|
||||
(void) CHECK_GL_ERROR();
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
using namespace gpu;
|
||||
|
||||
void GLBackend::do_setInputFormat(Batch& batch, uint32 paramOffset) {
|
||||
void GLBackend::do_setInputFormat(Batch& batch, size_t paramOffset) {
|
||||
Stream::FormatPointer format = batch._streamFormats.get(batch._params[paramOffset]._uint);
|
||||
|
||||
if (format != _input._format) {
|
||||
|
@ -21,7 +21,7 @@ void GLBackend::do_setInputFormat(Batch& batch, uint32 paramOffset) {
|
|||
}
|
||||
}
|
||||
|
||||
void GLBackend::do_setInputBuffer(Batch& batch, uint32 paramOffset) {
|
||||
void GLBackend::do_setInputBuffer(Batch& batch, size_t paramOffset) {
|
||||
Offset stride = batch._params[paramOffset + 0]._uint;
|
||||
Offset offset = batch._params[paramOffset + 1]._uint;
|
||||
BufferPointer buffer = batch._buffers.get(batch._params[paramOffset + 2]._uint);
|
||||
|
@ -232,14 +232,14 @@ void GLBackend::updateInput() {
|
|||
GLenum type = _elementTypeToGLType[attrib._element.getType()];
|
||||
// GLenum perLocationStride = strides[bufferNum];
|
||||
GLenum perLocationStride = attrib._element.getLocationSize();
|
||||
GLuint stride = strides[bufferNum];
|
||||
GLuint pointer = attrib._offset + offsets[bufferNum];
|
||||
GLuint stride = (GLuint)strides[bufferNum];
|
||||
GLuint pointer = (GLuint)(attrib._offset + offsets[bufferNum]);
|
||||
GLboolean isNormalized = attrib._element.isNormalized();
|
||||
|
||||
for (size_t locNum = 0; locNum < locationCount; ++locNum) {
|
||||
glVertexAttribPointer(slot + locNum, count, type, isNormalized, stride,
|
||||
reinterpret_cast<GLvoid*>(pointer + perLocationStride * locNum));
|
||||
glVertexAttribDivisor(slot + locNum, attrib._frequency);
|
||||
glVertexAttribPointer(slot + (GLuint)locNum, count, type, isNormalized, stride,
|
||||
reinterpret_cast<GLvoid*>(pointer + perLocationStride * (GLuint)locNum));
|
||||
glVertexAttribDivisor(slot + (GLuint)locNum, attrib._frequency);
|
||||
}
|
||||
|
||||
// TODO: Support properly the IAttrib version
|
||||
|
@ -287,7 +287,7 @@ void GLBackend::resetInputStage() {
|
|||
|
||||
}
|
||||
|
||||
void GLBackend::do_setIndexBuffer(Batch& batch, uint32 paramOffset) {
|
||||
void GLBackend::do_setIndexBuffer(Batch& batch, size_t paramOffset) {
|
||||
_input._indexBufferType = (Type)batch._params[paramOffset + 2]._uint;
|
||||
_input._indexBufferOffset = batch._params[paramOffset + 0]._uint;
|
||||
|
||||
|
@ -304,7 +304,7 @@ void GLBackend::do_setIndexBuffer(Batch& batch, uint32 paramOffset) {
|
|||
(void) CHECK_GL_ERROR();
|
||||
}
|
||||
|
||||
void GLBackend::do_setIndirectBuffer(Batch& batch, uint32 paramOffset) {
|
||||
void GLBackend::do_setIndirectBuffer(Batch& batch, size_t paramOffset) {
|
||||
_input._indirectBufferOffset = batch._params[paramOffset + 1]._uint;
|
||||
_input._indirectBufferStride = batch._params[paramOffset + 2]._uint;
|
||||
|
||||
|
|
|
@ -196,7 +196,7 @@ void GLBackend::resetOutputStage() {
|
|||
}
|
||||
}
|
||||
|
||||
void GLBackend::do_setFramebuffer(Batch& batch, uint32 paramOffset) {
|
||||
void GLBackend::do_setFramebuffer(Batch& batch, size_t paramOffset) {
|
||||
auto framebuffer = batch._framebuffers.get(batch._params[paramOffset]._uint);
|
||||
if (_output._framebuffer != framebuffer) {
|
||||
auto newFBO = getFramebufferID(framebuffer);
|
||||
|
@ -208,7 +208,7 @@ void GLBackend::do_setFramebuffer(Batch& batch, uint32 paramOffset) {
|
|||
}
|
||||
}
|
||||
|
||||
void GLBackend::do_clearFramebuffer(Batch& batch, uint32 paramOffset) {
|
||||
void GLBackend::do_clearFramebuffer(Batch& batch, size_t paramOffset) {
|
||||
if (_stereo._enable && !_pipeline._stateCache.scissorEnable) {
|
||||
qWarning("Clear without scissor in stereo mode");
|
||||
}
|
||||
|
@ -298,7 +298,7 @@ void GLBackend::do_clearFramebuffer(Batch& batch, uint32 paramOffset) {
|
|||
(void) CHECK_GL_ERROR();
|
||||
}
|
||||
|
||||
void GLBackend::do_blit(Batch& batch, uint32 paramOffset) {
|
||||
void GLBackend::do_blit(Batch& batch, size_t paramOffset) {
|
||||
auto srcframebuffer = batch._framebuffers.get(batch._params[paramOffset]._uint);
|
||||
Vec4i srcvp;
|
||||
for (size_t i = 0; i < 4; ++i) {
|
||||
|
|
|
@ -57,7 +57,7 @@ GLBackend::GLPipeline* GLBackend::syncGPUObject(const Pipeline& pipeline) {
|
|||
return object;
|
||||
}
|
||||
|
||||
void GLBackend::do_setPipeline(Batch& batch, uint32 paramOffset) {
|
||||
void GLBackend::do_setPipeline(Batch& batch, size_t paramOffset) {
|
||||
PipelinePointer pipeline = batch._pipelines.get(batch._params[paramOffset + 0]._uint);
|
||||
|
||||
if (_pipeline._pipeline == pipeline) {
|
||||
|
@ -168,7 +168,7 @@ void GLBackend::resetUniformStage() {
|
|||
}
|
||||
}
|
||||
|
||||
void GLBackend::do_setUniformBuffer(Batch& batch, uint32 paramOffset) {
|
||||
void GLBackend::do_setUniformBuffer(Batch& batch, size_t paramOffset) {
|
||||
GLuint slot = batch._params[paramOffset + 3]._uint;
|
||||
BufferPointer uniformBuffer = batch._buffers.get(batch._params[paramOffset + 2]._uint);
|
||||
GLintptr rangeStart = batch._params[paramOffset + 1]._uint;
|
||||
|
@ -237,7 +237,7 @@ void GLBackend::resetResourceStage() {
|
|||
}
|
||||
}
|
||||
|
||||
void GLBackend::do_setResourceTexture(Batch& batch, uint32 paramOffset) {
|
||||
void GLBackend::do_setResourceTexture(Batch& batch, size_t paramOffset) {
|
||||
GLuint slot = batch._params[paramOffset + 1]._uint;
|
||||
TexturePointer resourceTexture = batch._textures.get(batch._params[paramOffset + 0]._uint);
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ GLuint GLBackend::getQueryID(const QueryPointer& query) {
|
|||
}
|
||||
}
|
||||
|
||||
void GLBackend::do_beginQuery(Batch& batch, uint32 paramOffset) {
|
||||
void GLBackend::do_beginQuery(Batch& batch, size_t paramOffset) {
|
||||
auto query = batch._queries.get(batch._params[paramOffset]._uint);
|
||||
GLQuery* glquery = syncGPUObject(*query);
|
||||
if (glquery) {
|
||||
|
@ -74,7 +74,7 @@ void GLBackend::do_beginQuery(Batch& batch, uint32 paramOffset) {
|
|||
}
|
||||
}
|
||||
|
||||
void GLBackend::do_endQuery(Batch& batch, uint32 paramOffset) {
|
||||
void GLBackend::do_endQuery(Batch& batch, size_t paramOffset) {
|
||||
auto query = batch._queries.get(batch._params[paramOffset]._uint);
|
||||
GLQuery* glquery = syncGPUObject(*query);
|
||||
if (glquery) {
|
||||
|
@ -88,7 +88,7 @@ void GLBackend::do_endQuery(Batch& batch, uint32 paramOffset) {
|
|||
}
|
||||
}
|
||||
|
||||
void GLBackend::do_getQuery(Batch& batch, uint32 paramOffset) {
|
||||
void GLBackend::do_getQuery(Batch& batch, size_t paramOffset) {
|
||||
auto query = batch._queries.get(batch._params[paramOffset]._uint);
|
||||
GLQuery* glquery = syncGPUObject(*query);
|
||||
if (glquery) {
|
||||
|
|
|
@ -763,7 +763,7 @@ void GLBackend::do_setStateColorWriteMask(uint32 mask) {
|
|||
}
|
||||
|
||||
|
||||
void GLBackend::do_setStateBlendFactor(Batch& batch, uint32 paramOffset) {
|
||||
void GLBackend::do_setStateBlendFactor(Batch& batch, size_t paramOffset) {
|
||||
|
||||
Vec4 factor(batch._params[paramOffset + 0]._float,
|
||||
batch._params[paramOffset + 1]._float,
|
||||
|
@ -774,7 +774,7 @@ void GLBackend::do_setStateBlendFactor(Batch& batch, uint32 paramOffset) {
|
|||
(void) CHECK_GL_ERROR();
|
||||
}
|
||||
|
||||
void GLBackend::do_setStateScissorRect(Batch& batch, uint32 paramOffset) {
|
||||
void GLBackend::do_setStateScissorRect(Batch& batch, size_t paramOffset) {
|
||||
Vec4i rect;
|
||||
memcpy(&rect, batch.editData(batch._params[paramOffset]._uint), sizeof(Vec4i));
|
||||
|
||||
|
|
|
@ -15,22 +15,22 @@
|
|||
using namespace gpu;
|
||||
|
||||
// Transform Stage
|
||||
void GLBackend::do_setModelTransform(Batch& batch, uint32 paramOffset) {
|
||||
void GLBackend::do_setModelTransform(Batch& batch, size_t paramOffset) {
|
||||
_transform._model = batch._transforms.get(batch._params[paramOffset]._uint);
|
||||
_transform._invalidModel = true;
|
||||
}
|
||||
|
||||
void GLBackend::do_setViewTransform(Batch& batch, uint32 paramOffset) {
|
||||
void GLBackend::do_setViewTransform(Batch& batch, size_t paramOffset) {
|
||||
_transform._view = batch._transforms.get(batch._params[paramOffset]._uint);
|
||||
_transform._invalidView = true;
|
||||
}
|
||||
|
||||
void GLBackend::do_setProjectionTransform(Batch& batch, uint32 paramOffset) {
|
||||
void GLBackend::do_setProjectionTransform(Batch& batch, size_t paramOffset) {
|
||||
memcpy(&_transform._projection, batch.editData(batch._params[paramOffset]._uint), sizeof(Mat4));
|
||||
_transform._invalidProj = true;
|
||||
}
|
||||
|
||||
void GLBackend::do_setViewportTransform(Batch& batch, uint32 paramOffset) {
|
||||
void GLBackend::do_setViewportTransform(Batch& batch, size_t paramOffset) {
|
||||
memcpy(&_transform._viewport, batch.editData(batch._params[paramOffset]._uint), sizeof(Vec4i));
|
||||
|
||||
ivec4& vp = _transform._viewport;
|
||||
|
@ -49,7 +49,7 @@ void GLBackend::do_setViewportTransform(Batch& batch, uint32 paramOffset) {
|
|||
_transform._invalidViewport = true;
|
||||
}
|
||||
|
||||
void GLBackend::do_setDepthRangeTransform(Batch& batch, uint32 paramOffset) {
|
||||
void GLBackend::do_setDepthRangeTransform(Batch& batch, size_t paramOffset) {
|
||||
|
||||
Vec2 depthRange(batch._params[paramOffset + 0]._float, batch._params[paramOffset + 1]._float);
|
||||
|
||||
|
@ -142,7 +142,8 @@ void GLBackend::TransformStageState::preUpdate(size_t commandIndex, const Stereo
|
|||
}
|
||||
|
||||
void GLBackend::TransformStageState::transfer() const {
|
||||
static QByteArray bufferData;
|
||||
// FIXME not thread safe
|
||||
static std::vector<uint8_t> bufferData;
|
||||
if (!_cameras.empty()) {
|
||||
glBindBuffer(GL_UNIFORM_BUFFER, _cameraBuffer);
|
||||
bufferData.resize(_cameraUboSize * _cameras.size());
|
||||
|
@ -168,22 +169,23 @@ void GLBackend::TransformStageState::transfer() const {
|
|||
}
|
||||
|
||||
void GLBackend::TransformStageState::update(size_t commandIndex, const StereoState& stereo) const {
|
||||
int offset = -1;
|
||||
static const size_t INVALID_OFFSET = (size_t)-1;
|
||||
size_t offset = INVALID_OFFSET;
|
||||
while ((_objectsItr != _objectOffsets.end()) && (commandIndex >= (*_objectsItr).first)) {
|
||||
offset = (*_objectsItr).second;
|
||||
++_objectsItr;
|
||||
}
|
||||
if (offset >= 0) {
|
||||
if (offset != INVALID_OFFSET) {
|
||||
glBindBufferRange(GL_UNIFORM_BUFFER, TRANSFORM_OBJECT_SLOT,
|
||||
_objectBuffer, offset, sizeof(Backend::TransformObject));
|
||||
}
|
||||
|
||||
offset = -1;
|
||||
offset = INVALID_OFFSET;
|
||||
while ((_camerasItr != _cameraOffsets.end()) && (commandIndex >= (*_camerasItr).first)) {
|
||||
offset = (*_camerasItr).second;
|
||||
++_camerasItr;
|
||||
}
|
||||
if (offset >= 0) {
|
||||
if (offset != INVALID_OFFSET) {
|
||||
// We include both camera offsets for stereo
|
||||
if (stereo._enable && stereo._pass) {
|
||||
offset += _cameraUboSize;
|
||||
|
|
|
@ -26,9 +26,9 @@ namespace gpu {
|
|||
|
||||
class Resource {
|
||||
public:
|
||||
typedef unsigned int Size;
|
||||
typedef size_t Size;
|
||||
|
||||
static const Size NOT_ALLOCATED = -1;
|
||||
static const Size NOT_ALLOCATED = (Size)-1;
|
||||
|
||||
// The size in bytes of data stored in the resource
|
||||
virtual Size getSize() const = 0;
|
||||
|
|
|
@ -93,19 +93,14 @@ public:
|
|||
};
|
||||
typedef std::map< Slot, ChannelInfo > ChannelMap;
|
||||
|
||||
Format() :
|
||||
_attributes(),
|
||||
_elementTotalSize(0) {}
|
||||
~Format() {}
|
||||
|
||||
uint32 getNumAttributes() const { return _attributes.size(); }
|
||||
size_t getNumAttributes() const { return _attributes.size(); }
|
||||
const AttributeMap& getAttributes() const { return _attributes; }
|
||||
|
||||
uint8 getNumChannels() const { return _channels.size(); }
|
||||
size_t getNumChannels() const { return _channels.size(); }
|
||||
const ChannelMap& getChannels() const { return _channels; }
|
||||
Offset getChannelStride(Slot channel) const { return _channels.at(channel)._stride; }
|
||||
|
||||
uint32 getElementTotalSize() const { return _elementTotalSize; }
|
||||
size_t getElementTotalSize() const { return _elementTotalSize; }
|
||||
|
||||
bool setAttribute(Slot slot, Slot channel, Element element, Offset offset = 0, Frequency frequency = PER_VERTEX);
|
||||
bool setAttribute(Slot slot, Frequency frequency = PER_VERTEX);
|
||||
|
@ -115,7 +110,7 @@ public:
|
|||
protected:
|
||||
AttributeMap _attributes;
|
||||
ChannelMap _channels;
|
||||
uint32 _elementTotalSize;
|
||||
uint32 _elementTotalSize { 0 };
|
||||
|
||||
void evaluateCache();
|
||||
};
|
||||
|
@ -140,7 +135,7 @@ public:
|
|||
const Buffers& getBuffers() const { return _buffers; }
|
||||
const Offsets& getOffsets() const { return _offsets; }
|
||||
const Strides& getStrides() const { return _strides; }
|
||||
uint32 getNumBuffers() const { return _buffers.size(); }
|
||||
size_t getNumBuffers() const { return _buffers.size(); }
|
||||
|
||||
BufferStream makeRangedStream(uint32 offset, uint32 count = -1) const;
|
||||
|
||||
|
|
Loading…
Reference in a new issue