merge upstream/master into andrew/inertia

This commit is contained in:
Andrew Meadows 2015-01-08 10:24:05 -08:00
commit 1d371a9627
10 changed files with 93 additions and 63 deletions

View file

@ -21,17 +21,17 @@
if (WIN32)
include("${MACRO_DIR}/HifiLibrarySearchHints.cmake")
hifi_library_search_hints("glew")
find_path(GLEW_INCLUDE_DIRS GL/glew.h PATH_SUFFIXES include HINTS ${GLEW_SEARCH_DIRS})
find_library(GLEW_LIBRARY_RELEASE glew32s PATH_SUFFIXES "lib/Release/Win32" "lib" HINTS ${GLEW_SEARCH_DIRS})
find_library(GLEW_LIBRARY_DEBUG glew32s PATH_SUFFIXES "lib/Debug/Win32" "lib" HINTS ${GLEW_SEARCH_DIRS})
find_path(GLEW_INCLUDE_DIRS GL/glew.h PATH_SUFFIXES include HINTS ${GLEW_SEARCH_DIRS})
find_library(GLEW_LIBRARY_RELEASE glew32s PATH_SUFFIXES "lib/Release/Win32" "lib" HINTS ${GLEW_SEARCH_DIRS})
find_library(GLEW_LIBRARY_DEBUG glew32sd PATH_SUFFIXES "lib/Debug/Win32" "lib" HINTS ${GLEW_SEARCH_DIRS})
include(SelectLibraryConfigurations)
select_library_configurations(GLEW)
endif ()
set(GLEW_LIBRARIES "${GLEW_LIBRARY}")
set(GLEW_LIBRARIES ${GLEW_LIBRARY})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GLEW DEFAULT_MSG GLEW_INCLUDE_DIRS GLEW_LIBRARIES)

View file

@ -73,7 +73,7 @@ var soundPlaying = false;
var selectorPressed = false;
var position;
MyAvatar.attach(guitarModel, "Hips", {x: -0.0, y: -0.0, z: 0.0}, Quat.fromPitchYawRollDegrees(0, 0, 0), 1.0);
MyAvatar.attach(guitarModel, "Hips", {x: -0.2, y: 0.0, z: 0.1}, Quat.fromPitchYawRollDegrees(90, 00, 90), 1.0);
function checkHands(deltaTime) {
for (var palm = 0; palm < 2; palm++) {

View file

@ -22,7 +22,7 @@ var oldMode = Camera.mode;
function cancelLookAt() {
if (lookingAtSomething) {
lookingAtSomething = false;
//Camera.stopLooking();
Camera.stopLooking();
Camera.mode = oldMode;
releaseMovementKeys();
}
@ -74,7 +74,7 @@ function mousePressEvent(event) {
Camera.mode = "independent";
// tell the camera to fix it's look at on the point we clicked
//Camera.keepLookingAt(intersection.intersection);
Camera.keepLookingAt(intersection.intersection);
// keep track of the fact that we're in this looking at mode
lookingAtSomething = true;

View file

@ -229,7 +229,7 @@ else (APPLE)
# we're using static GLEW, so define GLEW_STATIC
add_definitions(-DGLEW_STATIC)
target_link_libraries(${TARGET_NAME} "${GLEW_LIBRARIES}" "${NSIGHT_LIBRARIES}" wsock32.lib opengl32.lib Winmm.lib)
target_link_libraries(${TARGET_NAME} ${GLEW_LIBRARIES} "${NSIGHT_LIBRARIES}" wsock32.lib opengl32.lib Winmm.lib)
# try to find the Nsight package and add it to the build if we find it
find_package(NSIGHT)

View file

@ -3,11 +3,6 @@
<TS version="2.1" language="en_US">
<context>
<name>Application</name>
<message>
<location filename="src/Application.cpp" line="1481"/>
<source>Export Voxels</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="src/Application.cpp" line="1482"/>
<source>Sparse Voxel Octree Files (*.svo)</source>
@ -226,45 +221,23 @@
<message>
<location filename="ui/preferencesDialog.ui" line="1125"/>
<location filename="../build/interface/ui_preferencesDialog.h" line="636"/>
<source>Voxels</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/preferencesDialog.ui" line="1157"/>
<location filename="../build/interface/ui_preferencesDialog.h" line="637"/>
<source>Maximum voxels</source>
<source>Octree</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/preferencesDialog.ui" line="1236"/>
<location filename="../build/interface/ui_preferencesDialog.h" line="638"/>
<source>Max voxels sent each second</source>
<source>Max packets sent each second</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QObject</name>
<message>
<location filename="src/ui/VoxelImportDialog.cpp" line="22"/>
<location filename="src/ui/VoxelImportDialog.cpp" line="23"/>
<source>Import Voxels</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="src/ui/VoxelImportDialog.cpp" line="24"/>
<source>Loading ...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="src/ui/VoxelImportDialog.cpp" line="25"/>
<source>Place voxels</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="src/ui/VoxelImportDialog.cpp" line="26"/>
<source>&lt;b&gt;Import&lt;/b&gt; %1 as voxels</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="src/ui/VoxelImportDialog.cpp" line="27"/>
<source>Cancel</source>

View file

@ -66,6 +66,12 @@ Audio::Audio() :
_inputRingBuffer(0),
_receivedAudioStream(0, RECEIVED_AUDIO_STREAM_CAPACITY_FRAMES, InboundAudioStream::Settings()),
_isStereoInput(false),
_outputBufferSizeFrames(DEFAULT_AUDIO_OUTPUT_BUFFER_SIZE_FRAMES),
_outputStarveDetectionEnabled(true),
_outputStarveDetectionStartTimeMsec(0),
_outputStarveDetectionCount(0),
_outputStarveDetectionPeriodMsec(DEFAULT_AUDIO_OUTPUT_STARVE_DETECTION_PERIOD),
_outputStarveDetectionThreshold(DEFAULT_AUDIO_OUTPUT_STARVE_DETECTION_THRESHOLD),
_averagedLatency(0.0f),
_lastInputLoudness(0.0f),
_timeSinceLastClip(-1.0f),
@ -81,12 +87,6 @@ Audio::Audio() :
_noiseSourceEnabled(false),
_toneSourceEnabled(true),
_outgoingAvatarAudioSequenceNumber(0),
_outputBufferSizeFrames(DEFAULT_AUDIO_OUTPUT_BUFFER_SIZE_FRAMES),
_outputStarveDetectionStartTimeMsec(0),
_outputStarveDetectionCount(0),
_outputStarveDetectionEnabled(true),
_outputStarveDetectionPeriodMsec(DEFAULT_AUDIO_OUTPUT_STARVE_DETECTION_PERIOD),
_outputStarveDetectionThreshold(DEFAULT_AUDIO_OUTPUT_STARVE_DETECTION_THRESHOLD),
_audioOutputIODevice(_receivedAudioStream, this),
_stats(&_receivedAudioStream),
_inputGate()

View file

@ -55,16 +55,44 @@ Camera::Camera() :
_farClip(DEFAULT_FAR_CLIP), // default
_hmdPosition(),
_hmdRotation(),
_targetPosition(),
_targetRotation(),
_scale(1.0f)
_scale(1.0f),
_isKeepLookingAt(false),
_lookingAt(0.0f, 0.0f, 0.0f)
{
}
void Camera::update(float deltaTime) {
if (_isKeepLookingAt) {
lookAt(_lookingAt);
}
return;
}
void Camera::setPosition(const glm::vec3& position) {
_position = position;
}
void Camera::setRotation(const glm::quat& rotation) {
_rotation = rotation;
if (_isKeepLookingAt) {
lookAt(_lookingAt);
}
}
void Camera::setHmdPosition(const glm::vec3& hmdPosition) {
_hmdPosition = hmdPosition;
if (_isKeepLookingAt) {
lookAt(_lookingAt);
}
}
void Camera::setHmdRotation(const glm::quat& hmdRotation) {
_hmdRotation = hmdRotation;
if (_isKeepLookingAt) {
lookAt(_lookingAt);
}
}
float Camera::getFarClip() const {
return (_scale * _farClip < std::numeric_limits<int16_t>::max())
? _scale * _farClip
@ -81,15 +109,15 @@ void Camera::setFieldOfView(float f) {
_fieldOfView = f;
}
void Camera::setAspectRatio(float a) {
void Camera::setAspectRatio(float a) {
_aspectRatio = a;
}
void Camera::setNearClip(float n) {
void Camera::setNearClip(float n) {
_nearClip = n;
}
void Camera::setFarClip(float f) {
void Camera::setFarClip(float f) {
_farClip = f;
}
@ -136,3 +164,17 @@ void Camera::setModeString(const QString& mode) {
QString Camera::getModeString() const {
return modeToString(_mode);
}
void Camera::lookAt(const glm::vec3& lookAt) {
glm::vec3 up = IDENTITY_UP;
glm::mat4 lookAtMatrix = glm::lookAt(_position, lookAt, up);
glm::quat rotation = glm::quat_cast(lookAtMatrix);
rotation.w = -rotation.w; // Rosedale approved
_rotation = rotation;
}
void Camera::keepLookingAt(const glm::vec3& point) {
lookAt(point);
_isKeepLookingAt = true;
_lookingAt = point;
}

View file

@ -43,9 +43,9 @@ public:
void update( float deltaTime );
void setRotation(const glm::quat& rotation) { _rotation = rotation; };
void setHmdPosition(const glm::vec3& hmdPosition) { _hmdPosition = hmdPosition; }
void setHmdRotation(const glm::quat& hmdRotation) { _hmdRotation = hmdRotation; };
void setRotation(const glm::quat& rotation);
void setHmdPosition(const glm::vec3& hmdPosition);
void setHmdRotation(const glm::quat& hmdRotation);
void setMode(CameraMode m);
void setFieldOfView(float f);
@ -73,13 +73,25 @@ public slots:
void setModeString(const QString& mode);
glm::vec3 getPosition() const { return _position + _hmdPosition; }
void setPosition(const glm::vec3& position) { _position = position; }
void setPosition(const glm::vec3& position);
void setOrientation(const glm::quat& orientation) { setRotation(orientation); }
glm::quat getOrientation() const { return getRotation(); }
PickRay computePickRay(float x, float y);
PickRay computeViewPickRay(float xRatio, float yRatio);
// These only work on independent cameras
/// one time change to what the camera is looking at
void lookAt(const glm::vec3& value);
/// fix what the camera is looking at, and keep the camera looking at this even if position changes
void keepLookingAt(const glm::vec3& value);
/// stops the keep looking at feature, doesn't change what's being looked at, but will stop camera from
/// continuing to update it's orientation to keep looking at the item
void stopLooking() { _isKeepLookingAt = false; }
signals:
void modeUpdated(const QString& newMode);
@ -95,9 +107,9 @@ private:
glm::quat _rotation;
glm::vec3 _hmdPosition;
glm::quat _hmdRotation;
glm::vec3 _targetPosition;
glm::quat _targetRotation;
float _scale;
bool _isKeepLookingAt;
glm::vec3 _lookingAt;
};
#endif // hifi_Camera_h

View file

@ -1273,7 +1273,7 @@
</layout>
</item>
<item>
<widget class="QLabel" name="voxelsTitleLabel_2">
<widget class="QLabel" name="octreeTitleLabel_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
@ -2130,7 +2130,7 @@
</layout>
</item>
<item>
<widget class="QLabel" name="voxelsTitleLabel">
<widget class="QLabel" name="octreeTitleLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
@ -2155,7 +2155,7 @@
<string notr="true">color:#29967e</string>
</property>
<property name="text">
<string>Voxels</string>
<string>Octree</string>
</property>
<property name="alignment">
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
@ -2184,7 +2184,7 @@
</font>
</property>
<property name="text">
<string>Max voxels sent each second</string>
<string>Max packets sent each second</string>
</property>
<property name="indent">
<number>0</number>

View file

@ -71,7 +71,8 @@ void EntityMotionState::setWorldTransform(const btTransform& worldTrans) {
_entity->setVelocityInMeters(v);
getAngularVelocity(v);
_entity->setAngularVelocity(v);
// DANGER! EntityItem stores angularVelocity in degrees/sec!!!
_entity->setAngularVelocity(glm::degrees(v));
_outgoingPacketFlags = DIRTY_PHYSICS_FLAGS;
EntityMotionState::enqueueOutgoingEntity(_entity);
@ -82,7 +83,8 @@ void EntityMotionState::applyVelocities() const {
#ifdef USE_BULLET_PHYSICS
if (_body) {
setVelocity(_entity->getVelocityInMeters());
setAngularVelocity(_entity->getAngularVelocity());
// DANGER! EntityItem stores angularVelocity in degrees/sec!!!
setAngularVelocity(glm::radians(_entity->getAngularVelocity()));
_body->setActivationState(ACTIVE_TAG);
}
#endif // USE_BULLET_PHYSICS
@ -140,7 +142,8 @@ void EntityMotionState::sendUpdate(OctreeEditPacketSender* packetSender, uint32_
properties.setVelocity(_sentVelocity);
_sentAcceleration = bulletToGLM(_body->getGravity());
properties.setGravity(_sentAcceleration);
properties.setAngularVelocity(_sentAngularVelocity);
// DANGER! EntityItem stores angularVelocity in degrees/sec!!!
properties.setAngularVelocity(glm::degrees(_sentAngularVelocity));
}
// RELIABLE_SEND_HACK: count number of updates for entities at rest so we can stop sending them after some limit.