mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 18:23:54 +02:00
Merge branch 'protocol' of github.com:birarda/hifi into receive_packets
Conflicts: assignment-client/src/audio/AudioMixer.cpp interface/src/Application.cpp libraries/networking/src/Packet.cpp
This commit is contained in:
commit
0edc909818
33 changed files with 526 additions and 242 deletions
|
@ -475,7 +475,6 @@ int AudioMixer::prepareMixForListeningNode(Node* node) {
|
|||
}
|
||||
|
||||
void AudioMixer::sendAudioEnvironmentPacket(SharedNodePointer node) {
|
||||
|
||||
// Send stream properties
|
||||
bool hasReverb = false;
|
||||
float reverbTime, wetLevel;
|
||||
|
|
|
@ -119,7 +119,7 @@ int EntityServer::sendSpecialPackets(const SharedNodePointer& node, OctreeQueryN
|
|||
auto specialPacket = tree->encodeEntitiesDeletedSince(queryNode->getSequenceNumber(), deletedEntitiesSentAt,
|
||||
hasMoreToSend);
|
||||
|
||||
queryNode->packetSent(*specialPacket.get());
|
||||
queryNode->packetSent(*specialPacket);
|
||||
|
||||
totalBytes += specialPacket->getSizeWithHeader();
|
||||
packetsSent++;
|
||||
|
|
|
@ -65,70 +65,55 @@ function removeLine() {
|
|||
|
||||
|
||||
function createOrUpdateLine(event) {
|
||||
var pickRay = Camera.computePickRay(event.x, event.y);
|
||||
var intersection = Entities.findRayIntersection(pickRay, true); // accurate picking
|
||||
var props = Entities.getEntityProperties(intersection.entityID);
|
||||
var pickRay = Camera.computePickRay(event.x, event.y);
|
||||
var intersection = Entities.findRayIntersection(pickRay, true); // accurate picking
|
||||
var props = Entities.getEntityProperties(intersection.entityID);
|
||||
|
||||
if (intersection.intersects && userCanPoint) {
|
||||
var points = [nearLinePoint(intersection.intersection), intersection.intersection]
|
||||
if (lineIsRezzed) {
|
||||
Entities.editEntity(lineEntityID, {
|
||||
position: nearLinePoint(intersection.intersection),
|
||||
linePoints: points,
|
||||
dimensions: {
|
||||
x: 1,
|
||||
y: 1,
|
||||
z: 1
|
||||
},
|
||||
lifetime: 15 + props.lifespan // renew lifetime
|
||||
});
|
||||
if (intersection.intersects && userCanPoint) {
|
||||
var points = [Vec3.subtract(nearLinePoint(intersection.intersection), MyAvatar.position),
|
||||
Vec3.subtract(intersection.intersection, MyAvatar.position)];
|
||||
if (lineIsRezzed) {
|
||||
Entities.editEntity(lineEntityID, {
|
||||
linePoints: points,
|
||||
position: MyAvatar.position,
|
||||
lifetime: 15 + props.lifespan // renew lifetime
|
||||
});
|
||||
// Entities.setAllPoints(lineEntityID, points);
|
||||
} else {
|
||||
lineIsRezzed = true;
|
||||
lineEntityID = Entities.addEntity({
|
||||
type: "Line",
|
||||
position: MyAvatar.position,
|
||||
linePoints: points,
|
||||
dimensions: { x: 100, y: 100, z: 100 },
|
||||
color: { red: 255, green: 255, blue: 255 },
|
||||
lifetime: 15 // if someone crashes while pointing, don't leave the line there forever.
|
||||
});
|
||||
}
|
||||
} else {
|
||||
lineIsRezzed = true;
|
||||
lineEntityID = Entities.addEntity({
|
||||
type: "Line",
|
||||
position: nearLinePoint(intersection.intersection),
|
||||
linePoints: points,
|
||||
dimensions: {
|
||||
x: 1,
|
||||
y: 1,
|
||||
z: 1
|
||||
},
|
||||
color: {
|
||||
red: 255,
|
||||
green: 255,
|
||||
blue: 255
|
||||
},
|
||||
lifetime: 15 // if someone crashes while pointing, don't leave the line there forever.
|
||||
});
|
||||
removeLine();
|
||||
}
|
||||
} else {
|
||||
removeLine();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function mousePressEvent(event) {
|
||||
if (!event.isLeftButton) {
|
||||
return;
|
||||
}
|
||||
|
||||
createOrUpdateLine(event);
|
||||
var clickedOverlay = Overlays.getOverlayAtPoint({
|
||||
x: event.x,
|
||||
y: event.y
|
||||
});
|
||||
if (clickedOverlay == pointerButton) {
|
||||
userCanPoint = !userCanPoint;
|
||||
if (userCanPoint === true) {
|
||||
Overlays.editOverlay(pointerButton, {
|
||||
color: buttonOnColor
|
||||
});
|
||||
} else {
|
||||
Overlays.editOverlay(pointerButton, {
|
||||
color: buttonOffColor
|
||||
});
|
||||
if (!event.isLeftButton) {
|
||||
return;
|
||||
}
|
||||
|
||||
var clickedOverlay = Overlays.getOverlayAtPoint({
|
||||
x: event.x,
|
||||
y: event.y
|
||||
});
|
||||
|
||||
if (clickedOverlay == pointerButton) {
|
||||
userCanPoint = !userCanPoint;
|
||||
if (userCanPoint === true) {
|
||||
Overlays.editOverlay(pointerButton, { color: buttonOnColor });
|
||||
} else {
|
||||
Overlays.editOverlay(pointerButton, { color: buttonOffColor });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
34
interface/resources/images/interface-logo.svg
Normal file
34
interface/resources/images/interface-logo.svg
Normal file
|
@ -0,0 +1,34 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 261 261" enable-background="new 0 0 261 261" xml:space="preserve">
|
||||
<g>
|
||||
<g>
|
||||
<circle fill="#149ABB" cx="130.5" cy="130.5" r="130.5"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#0C9AB2" d="M251,80.6c27.5,66.6-4.3,142.9-70.9,170.4S37.1,246.7,9.6,180"/>
|
||||
</g>
|
||||
<g opacity="0.21">
|
||||
<g>
|
||||
<path fill="#FFFFFF" d="M130.5,1.8c17.4,0,34.2,3.4,50.1,10.1c15.3,6.5,29.1,15.8,40.9,27.6s21.1,25.6,27.6,40.9
|
||||
c6.7,15.9,10.1,32.7,10.1,50.1s-3.4,34.2-10.1,50.1c-6.5,15.3-15.8,29.1-27.6,40.9c-11.8,11.8-25.6,21.1-40.9,27.6
|
||||
c-15.9,6.7-32.7,10.1-50.1,10.1s-34.2-3.4-50.1-10.1c-15.3-6.5-29.1-15.8-40.9-27.6c-11.8-11.8-21.1-25.6-27.6-40.9
|
||||
c-6.7-15.9-10.1-32.7-10.1-50.1s3.4-34.2,10.1-50.1c6.5-15.3,15.8-29.1,27.6-40.9s25.6-21.1,40.9-27.6
|
||||
C96.3,5.2,113.1,1.8,130.5,1.8 M130.5,0C58.4,0,0,58.4,0,130.5S58.4,261,130.5,261S261,202.6,261,130.5S202.6,0,130.5,0L130.5,0z
|
||||
"/>
|
||||
</g>
|
||||
</g>
|
||||
<rect x="100.8" y="65.2" fill="#FFFFFF" width="59.4" height="98"/>
|
||||
<rect x="3.4" y="169.4" fill="#FFFFFF" width="254.2" height="1.9"/>
|
||||
<rect x="3.4" y="176" fill="#FFFFFF" width="254.2" height="1.9"/>
|
||||
<rect x="3.4" y="184.7" fill="#FFFFFF" width="254.2" height="1.9"/>
|
||||
<rect x="3.4" y="197.9" fill="#FFFFFF" width="254.2" height="1.9"/>
|
||||
<path fill="#FFFFFF" d="M93.7,169.5l-14.7,75.8c0,0,47.4,23.4,101.2,0.5c33.3-14.2,51.5-41.5,51.5-41.5L154,170.2L93.7,169.5z"/>
|
||||
<path fill="#FFFFFF" d="M166,169.5l14.7,75.8c0,0-47.4,23.4-101.2,0.5c-33.3-14.2-51.5-41.5-51.5-41.5l77.5-34.1L166,169.5z"/>
|
||||
<rect x="85.8" y="184.7" fill="#149ABB" width="89.4" height="1.9"/>
|
||||
<rect x="98" y="176" fill="#149ABB" width="65.1" height="1.9"/>
|
||||
<rect x="56.4" y="197.9" fill="#149ABB" width="148.2" height="1.9"/>
|
||||
<rect x="51.4" y="219.4" fill="#149ABB" width="158.3" height="1.9"/>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2 KiB |
|
@ -41,8 +41,6 @@ DialogContainer {
|
|||
readonly property int closeMargin: 16
|
||||
readonly property real tan30: 0.577 // tan(30°)
|
||||
readonly property int inputSpacing: 16
|
||||
property int maximumX: parent ? parent.width - width : 0
|
||||
property int maximumY: parent ? parent.height - height : 0
|
||||
|
||||
Rectangle {
|
||||
id: backgroundRectangle
|
||||
|
|
|
@ -1,164 +1,176 @@
|
|||
import Hifi 1.0
|
||||
import QtQuick 2.3
|
||||
import QtQuick.Controls 1.3
|
||||
import QtQuick.Controls.Styles 1.3
|
||||
import QtGraphicalEffects 1.0
|
||||
import "controls"
|
||||
import "styles"
|
||||
|
||||
DialogContainer {
|
||||
HifiConstants { id: hifi }
|
||||
id: root
|
||||
HifiConstants { id: hifi }
|
||||
|
||||
objectName: "UpdateDialog"
|
||||
implicitWidth: updateDialog.width
|
||||
implicitHeight: updateDialog.height
|
||||
|
||||
implicitWidth: updateDialog.implicitWidth
|
||||
implicitHeight: updateDialog.implicitHeight
|
||||
|
||||
x: parent ? parent.width / 2 - width / 2 : 0
|
||||
y: parent ? parent.height / 2 - height / 2 : 0
|
||||
|
||||
property int maximumX: parent ? parent.width - width : 0
|
||||
property int maximumY: parent ? parent.height - height : 0
|
||||
|
||||
UpdateDialog {
|
||||
id: updateDialog
|
||||
|
||||
implicitWidth: backgroundRectangle.width
|
||||
implicitHeight: backgroundRectangle.height
|
||||
|
||||
readonly property int inputWidth: 500
|
||||
readonly property int inputHeight: 60
|
||||
readonly property int contentWidth: 500
|
||||
readonly property int logoSize: 60
|
||||
readonly property int borderWidth: 30
|
||||
readonly property int closeMargin: 16
|
||||
readonly property int inputSpacing: 16
|
||||
readonly property int buttonWidth: 150
|
||||
readonly property int buttonHeight: 50
|
||||
readonly property int buttonRadius: 15
|
||||
|
||||
readonly property int buttonWidth: 100
|
||||
readonly property int buttonHeight: 30
|
||||
readonly property int noticeHeight: 15 * inputSpacing
|
||||
readonly property string fontFamily: Qt.platform.os === "windows" ? "Trebuchet MS" : "Trebuchet"
|
||||
|
||||
signal triggerBuildDownload
|
||||
signal closeUpdateDialog
|
||||
|
||||
Rectangle {
|
||||
id: backgroundRectangle
|
||||
color: "#ffffff"
|
||||
|
||||
width: updateDialog.contentWidth + updateDialog.borderWidth * 2
|
||||
height: mainContent.height + updateDialog.borderWidth * 2 - updateDialog.closeMargin / 2
|
||||
|
||||
MouseArea {
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
anchors {
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
drag {
|
||||
target: root
|
||||
minimumX: 0
|
||||
minimumY: 0
|
||||
maximumX: root.parent ? root.maximumX : 0
|
||||
maximumY: root.parent ? root.maximumY : 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Image {
|
||||
id: logo
|
||||
source: "../images/interface-logo.svg"
|
||||
width: updateDialog.logoSize
|
||||
height: updateDialog.logoSize
|
||||
anchors {
|
||||
top: mainContent.top
|
||||
right: mainContent.right
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
id: mainContent
|
||||
width: updateDialog.inputWidth
|
||||
width: updateDialog.contentWidth
|
||||
spacing: updateDialog.inputSpacing
|
||||
anchors {
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
verticalCenter: parent.verticalCenter
|
||||
topMargin: updateDialog.borderWidth
|
||||
top: parent.top
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: backgroundRectangle
|
||||
color: "#2c86b1"
|
||||
opacity: 0.85
|
||||
radius: updateDialog.closeMargin * 2
|
||||
|
||||
width: updateDialog.inputWidth + updateDialog.borderWidth * 2
|
||||
height: updateDialog.inputHeight * 6 + updateDialog.closeMargin * 2
|
||||
|
||||
Rectangle {
|
||||
id: dialogTitle
|
||||
width: updateDialog.inputWidth
|
||||
height: updateDialog.inputHeight
|
||||
radius: height / 2
|
||||
color: "#ebebeb"
|
||||
|
||||
id: header
|
||||
width: parent.width - updateDialog.logoSize - updateDialog.inputSpacing
|
||||
height: updateAvailable.height + versionDetails.height
|
||||
|
||||
Text {
|
||||
id: updateAvailable
|
||||
text: "Update Available"
|
||||
font {
|
||||
family: updateDialog.fontFamily
|
||||
pixelSize: hifi.fonts.pixelSize * 1.5
|
||||
weight: Font.DemiBold
|
||||
}
|
||||
color: "#303030"
|
||||
}
|
||||
|
||||
Text {
|
||||
id: versionDetails
|
||||
text: updateDialog.updateAvailableDetails
|
||||
font {
|
||||
family: updateDialog.fontFamily
|
||||
pixelSize: hifi.fonts.pixelSize * 0.6
|
||||
letterSpacing: -0.5
|
||||
}
|
||||
color: hifi.colors.text
|
||||
anchors {
|
||||
top: parent.top
|
||||
topMargin: updateDialog.inputSpacing
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
Text {
|
||||
id: updateAvailableText
|
||||
text: "Update Available"
|
||||
anchors {
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: parent.left
|
||||
leftMargin: updateDialog.inputSpacing
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
text: updateDialog.updateAvailableDetails
|
||||
font.pixelSize: 14
|
||||
color: hifi.colors.text
|
||||
anchors {
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: updateAvailableText.right
|
||||
leftMargin: 13
|
||||
}
|
||||
top: updateAvailable.bottom
|
||||
}
|
||||
}
|
||||
|
||||
Flickable {
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: updateDialog.noticeHeight
|
||||
|
||||
border {
|
||||
width: 1
|
||||
color: "#a0a0a0"
|
||||
}
|
||||
|
||||
ScrollView {
|
||||
id: scrollArea
|
||||
anchors {
|
||||
top: dialogTitle.bottom
|
||||
}
|
||||
contentWidth: updateDialog.inputWidth
|
||||
contentHeight: backgroundRectangle.height - (dialogTitle.height * 2.5)
|
||||
width: updateDialog.inputWidth
|
||||
height: backgroundRectangle.height - (dialogTitle.height * 2.5)
|
||||
flickableDirection: Flickable.VerticalFlick
|
||||
clip: true
|
||||
|
||||
TextEdit {
|
||||
id: releaseNotes
|
||||
wrapMode: TextEdit.Wrap
|
||||
width: parent.width
|
||||
readOnly: true
|
||||
text: updateDialog.releaseNotes
|
||||
font.pixelSize: 14
|
||||
color: hifi.colors.text
|
||||
anchors {
|
||||
left: parent.left
|
||||
leftMargin: updateDialog.borderWidth
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: downloadButton
|
||||
width: updateDialog.buttonWidth
|
||||
height: updateDialog.buttonHeight
|
||||
radius: updateDialog.buttonRadius
|
||||
color: "green"
|
||||
anchors {
|
||||
top: scrollArea.bottom
|
||||
topMargin: 10
|
||||
right: backgroundRectangle.right
|
||||
rightMargin: 15
|
||||
}
|
||||
width: parent.width - updateDialog.closeMargin
|
||||
height: parent.height
|
||||
horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff
|
||||
verticalScrollBarPolicy: Qt.ScrollBarAsNeeded
|
||||
anchors.right: parent.right
|
||||
|
||||
Text {
|
||||
text: "Upgrade"
|
||||
anchors {
|
||||
verticalCenter: parent.verticalCenter
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
id: releaseNotes
|
||||
wrapMode: Text.Wrap
|
||||
width: parent.width - updateDialog.closeMargin
|
||||
text: updateDialog.releaseNotes
|
||||
color: hifi.colors.text
|
||||
font {
|
||||
family: updateDialog.fontFamily
|
||||
pixelSize: hifi.fonts.pixelSize * 0.65
|
||||
}
|
||||
}
|
||||
MouseArea {
|
||||
id: downloadButtonAction
|
||||
anchors.fill: parent
|
||||
onClicked: updateDialog.triggerUpgrade()
|
||||
cursorShape: "PointingHandCursor"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Row {
|
||||
anchors.right: parent.right
|
||||
spacing: updateDialog.inputSpacing
|
||||
height: updateDialog.buttonHeight + updateDialog.closeMargin / 2
|
||||
|
||||
Rectangle {
|
||||
id: cancelButton
|
||||
width: updateDialog.buttonWidth
|
||||
height: updateDialog.buttonHeight
|
||||
radius: updateDialog.buttonRadius
|
||||
color: "red"
|
||||
anchors {
|
||||
top: scrollArea.bottom
|
||||
topMargin: 10
|
||||
right: downloadButton.left
|
||||
rightMargin: 15
|
||||
}
|
||||
|
||||
anchors.bottom: parent.bottom
|
||||
|
||||
Text {
|
||||
text: "Cancel"
|
||||
color: "#0c9ab4" // Same as logo
|
||||
font {
|
||||
family: updateDialog.fontFamily
|
||||
pixelSize: hifi.fonts.pixelSize * 1.2
|
||||
weight: Font.DemiBold
|
||||
}
|
||||
anchors {
|
||||
verticalCenter: parent.verticalCenter
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: cancelButtonAction
|
||||
anchors.fill: parent
|
||||
|
@ -166,7 +178,35 @@ DialogContainer {
|
|||
cursorShape: "PointingHandCursor"
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: updateButton
|
||||
width: updateDialog.buttonWidth
|
||||
height: updateDialog.buttonHeight
|
||||
anchors.bottom: parent.bottom
|
||||
|
||||
Text {
|
||||
text: "Update"
|
||||
color: "#0c9ab4" // Same as logo
|
||||
font {
|
||||
family: updateDialog.fontFamily
|
||||
pixelSize: hifi.fonts.pixelSize * 1.2
|
||||
weight: Font.DemiBold
|
||||
}
|
||||
anchors {
|
||||
verticalCenter: parent.verticalCenter
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: updateButtonAction
|
||||
anchors.fill: parent
|
||||
onClicked: updateDialog.triggerUpgrade()
|
||||
cursorShape: "PointingHandCursor"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4830,7 +4830,7 @@ mat4 Application::getEyeProjection(int eye) const {
|
|||
if (isHMDMode()) {
|
||||
return OculusManager::getEyeProjection(eye);
|
||||
}
|
||||
|
||||
|
||||
return _viewFrustum.getProjection();
|
||||
}
|
||||
|
||||
|
|
|
@ -458,6 +458,7 @@ Menu::Menu() {
|
|||
addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::RenderBoundingCollisionShapes);
|
||||
addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::RenderLookAtVectors, 0, false);
|
||||
addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::RenderFocusIndicator, 0, false);
|
||||
addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::ShowWhosLookingAtMe, 0, false);
|
||||
|
||||
MenuWrapper* handOptionsMenu = developerMenu->addMenu("Hands");
|
||||
addCheckableActionToQMenuAndActionHash(handOptionsMenu, MenuOption::AlignForearmsWithWrists, 0, false);
|
||||
|
|
|
@ -270,6 +270,7 @@ namespace MenuOption {
|
|||
const QString ShowBordersEntityNodes = "Show Entity Nodes";
|
||||
const QString ShowIKConstraints = "Show IK Constraints";
|
||||
const QString ShowRealtimeEntityStats = "Show Realtime Entity Stats";
|
||||
const QString ShowWhosLookingAtMe = "Show Who's Looking at Me";
|
||||
const QString SimpleShadows = "Simple";
|
||||
const QString SixenseEnabled = "Enable Hydra Support";
|
||||
const QString SixenseMouseInput = "Enable Sixense Mouse Input";
|
||||
|
|
|
@ -453,22 +453,36 @@ void Avatar::render(RenderArgs* renderArgs, const glm::vec3& cameraPosition, boo
|
|||
}
|
||||
}
|
||||
|
||||
// Stack indicator spheres
|
||||
float indicatorOffset = 0.0f;
|
||||
if (!_displayName.isEmpty() && _displayNameAlpha != 0.0f) {
|
||||
const float DISPLAY_NAME_INDICATOR_OFFSET = 0.22f;
|
||||
indicatorOffset = DISPLAY_NAME_INDICATOR_OFFSET;
|
||||
}
|
||||
const float INDICATOR_RADIUS = 0.03f;
|
||||
const float INDICATOR_INDICATOR_OFFSET = 3.0f * INDICATOR_RADIUS;
|
||||
|
||||
// If this is the avatar being looked at, render a little ball above their head
|
||||
if (_isLookAtTarget && Menu::getInstance()->isOptionChecked(MenuOption::RenderFocusIndicator)) {
|
||||
const float LOOK_AT_INDICATOR_RADIUS = 0.03f;
|
||||
const float LOOK_AT_INDICATOR_OFFSET = 0.22f;
|
||||
const glm::vec4 LOOK_AT_INDICATOR_COLOR = { 0.8f, 0.0f, 0.0f, 0.75f };
|
||||
glm::vec3 position;
|
||||
if (_displayName.isEmpty() || _displayNameAlpha == 0.0f) {
|
||||
position = glm::vec3(_position.x, getDisplayNamePosition().y, _position.z);
|
||||
} else {
|
||||
position = glm::vec3(_position.x, getDisplayNamePosition().y + LOOK_AT_INDICATOR_OFFSET, _position.z);
|
||||
}
|
||||
glm::vec3 position = glm::vec3(_position.x, getDisplayNamePosition().y + indicatorOffset, _position.z);
|
||||
Transform transform;
|
||||
transform.setTranslation(position);
|
||||
batch.setModelTransform(transform);
|
||||
DependencyManager::get<DeferredLightingEffect>()->renderSolidSphere(batch, LOOK_AT_INDICATOR_RADIUS
|
||||
, 15, 15, LOOK_AT_INDICATOR_COLOR);
|
||||
DependencyManager::get<DeferredLightingEffect>()->renderSolidSphere(batch, INDICATOR_RADIUS,
|
||||
15, 15, LOOK_AT_INDICATOR_COLOR);
|
||||
indicatorOffset += INDICATOR_INDICATOR_OFFSET;
|
||||
}
|
||||
|
||||
// If the avatar is looking at me, render an indication that they area
|
||||
if (getHead()->getIsLookingAtMe() && Menu::getInstance()->isOptionChecked(MenuOption::ShowWhosLookingAtMe)) {
|
||||
const glm::vec4 LOOKING_AT_ME_COLOR = { 0.8f, 0.65f, 0.0f, 0.1f };
|
||||
glm::vec3 position = glm::vec3(_position.x, getDisplayNamePosition().y + indicatorOffset, _position.z);
|
||||
Transform transform;
|
||||
transform.setTranslation(position);
|
||||
batch.setModelTransform(transform);
|
||||
DependencyManager::get<DeferredLightingEffect>()->renderSolidSphere(batch, INDICATOR_RADIUS,
|
||||
15, 15, LOOKING_AT_ME_COLOR);
|
||||
}
|
||||
|
||||
// quick check before falling into the code below:
|
||||
|
|
|
@ -72,9 +72,13 @@ void AvatarManager::init() {
|
|||
_myAvatar->init();
|
||||
_avatarHash.insert(MY_AVATAR_KEY, _myAvatar);
|
||||
|
||||
connect(DependencyManager::get<SceneScriptingInterface>().data(), &SceneScriptingInterface::shouldRenderAvatarsChanged, this, &AvatarManager::updateAvatarRenderStatus, Qt::QueuedConnection);
|
||||
|
||||
render::ScenePointer scene = Application::getInstance()->getMain3DScene();
|
||||
render::PendingChanges pendingChanges;
|
||||
_myAvatar->addToScene(_myAvatar, scene, pendingChanges);
|
||||
if (DependencyManager::get<SceneScriptingInterface>()->shouldRenderAvatars()) {
|
||||
_myAvatar->addToScene(_myAvatar, scene, pendingChanges);
|
||||
}
|
||||
scene->enqueuePendingChanges(pendingChanges);
|
||||
}
|
||||
|
||||
|
@ -158,7 +162,9 @@ AvatarSharedPointer AvatarManager::addAvatar(const QUuid& sessionUUID, const QWe
|
|||
auto avatar = std::dynamic_pointer_cast<Avatar>(AvatarHashMap::addAvatar(sessionUUID, mixerWeakPointer));
|
||||
render::ScenePointer scene = Application::getInstance()->getMain3DScene();
|
||||
render::PendingChanges pendingChanges;
|
||||
avatar->addToScene(avatar, scene, pendingChanges);
|
||||
if (DependencyManager::get<SceneScriptingInterface>()->shouldRenderAvatars()) {
|
||||
avatar->addToScene(avatar, scene, pendingChanges);
|
||||
}
|
||||
scene->enqueuePendingChanges(pendingChanges);
|
||||
return avatar;
|
||||
}
|
||||
|
@ -310,3 +316,23 @@ void AvatarManager::updateAvatarPhysicsShape(const QUuid& id) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AvatarManager::updateAvatarRenderStatus(bool shouldRenderAvatars) {
|
||||
if (DependencyManager::get<SceneScriptingInterface>()->shouldRenderAvatars()) {
|
||||
for (auto avatarData : _avatarHash) {
|
||||
auto avatar = std::dynamic_pointer_cast<Avatar>(avatarData);
|
||||
render::ScenePointer scene = Application::getInstance()->getMain3DScene();
|
||||
render::PendingChanges pendingChanges;
|
||||
avatar->addToScene(avatar, scene, pendingChanges);
|
||||
scene->enqueuePendingChanges(pendingChanges);
|
||||
}
|
||||
} else {
|
||||
for (auto avatarData : _avatarHash) {
|
||||
auto avatar = std::dynamic_pointer_cast<Avatar>(avatarData);
|
||||
render::ScenePointer scene = Application::getInstance()->getMain3DScene();
|
||||
render::PendingChanges pendingChanges;
|
||||
avatar->removeFromScene(avatar, scene, pendingChanges);
|
||||
scene->enqueuePendingChanges(pendingChanges);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,6 +62,7 @@ public:
|
|||
|
||||
public slots:
|
||||
void setShouldShowReceiveStats(bool shouldShowReceiveStats) { _shouldShowReceiveStats = shouldShowReceiveStats; }
|
||||
void updateAvatarRenderStatus(bool shouldRenderAvatars);
|
||||
|
||||
private:
|
||||
AvatarManager(QObject* parent = 0);
|
||||
|
|
|
@ -127,6 +127,7 @@ void ApplicationOverlay::renderOverlays(RenderArgs* renderArgs) {
|
|||
glDisable(GL_LIGHTING);
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glUseProgram(0);
|
||||
|
||||
// give external parties a change to hook in
|
||||
emit qApp->renderingOverlay();
|
||||
|
|
|
@ -24,9 +24,18 @@ UpdateDialog::UpdateDialog(QQuickItem* parent) :
|
|||
int currentVersion = QCoreApplication::applicationVersion().toInt();
|
||||
int latestVersion = applicationUpdater.data()->getBuildData().lastKey();
|
||||
int versionsBehind = latestVersion - currentVersion;
|
||||
_updateAvailableDetails = "v" + QString::number(latestVersion) + " released on " + applicationUpdater.data()->getBuildData()[latestVersion]["releaseTime"];
|
||||
_updateAvailableDetails += "\nYou are " + QString::number(versionsBehind) + " versions behind";
|
||||
_releaseNotes = applicationUpdater.data()->getBuildData()[latestVersion]["releaseNotes"];
|
||||
_updateAvailableDetails = "v" + QString::number(latestVersion) + " released on "
|
||||
+ QString(applicationUpdater.data()->getBuildData()[latestVersion]["releaseTime"]).replace(" ", " ");
|
||||
_updateAvailableDetails += "\nYou are " + QString::number(versionsBehind) + " version"
|
||||
+ (versionsBehind > 1 ? "s" : "") + " behind";
|
||||
|
||||
_releaseNotes = "";
|
||||
for (int i = latestVersion; i > currentVersion; i--) {
|
||||
QString releaseNotes = applicationUpdater.data()->getBuildData()[i]["releaseNotes"];
|
||||
releaseNotes.remove("<br />");
|
||||
releaseNotes.remove(QRegExp("^\n+"));
|
||||
_releaseNotes += "\n" + QString().sprintf("%d", i) + "\n" + releaseNotes + "\n";
|
||||
}
|
||||
}
|
||||
|
||||
const QString& UpdateDialog::updateAvailableDetails() const {
|
||||
|
|
|
@ -14,6 +14,11 @@
|
|||
#include <GeometryCache.h>
|
||||
#include <RegisteredMetaTypes.h>
|
||||
|
||||
#include "qapplication.h"
|
||||
|
||||
#include "gpu/Context.h"
|
||||
#include "gpu/StandardShaderLib.h"
|
||||
|
||||
ImageOverlay::ImageOverlay() :
|
||||
_imageURL(),
|
||||
_renderImage(false),
|
||||
|
@ -57,15 +62,42 @@ void ImageOverlay::render(RenderArgs* args) {
|
|||
return;
|
||||
}
|
||||
|
||||
// TODO: I commented all the code needed to migrate this ImageOverlay rendering from naked gl to gpu::Batch
|
||||
/*gpu::Batch localBatch;
|
||||
gpu::Batch& batch = (args->_batch ? (*args->_batch) : localBatch);
|
||||
static gpu::PipelinePointer drawPipeline;
|
||||
static int texcoordRectLoc = -1;
|
||||
static int colorLoc = -1;
|
||||
if (!drawPipeline) {
|
||||
auto blitProgram = gpu::StandardShaderLib::getProgram(gpu::StandardShaderLib::getDrawTexcoordRectTransformUnitQuadVS, gpu::StandardShaderLib::getDrawColoredTexturePS);
|
||||
gpu::Shader::makeProgram(*blitProgram);
|
||||
texcoordRectLoc = blitProgram->getUniforms().findLocation("texcoordRect");
|
||||
colorLoc = blitProgram->getUniforms().findLocation("color");
|
||||
|
||||
gpu::StatePointer blitState = gpu::StatePointer(new gpu::State());
|
||||
blitState->setBlendFunction(false, gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA);
|
||||
blitState->setColorWriteMask(true, true, true, true);
|
||||
drawPipeline = gpu::PipelinePointer(gpu::Pipeline::create(blitProgram, blitState));
|
||||
}
|
||||
*/
|
||||
// TODO: batch.setPipeline(drawPipeline);
|
||||
glUseProgram(0);
|
||||
|
||||
if (_renderImage) {
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glBindTexture(GL_TEXTURE_2D, _texture->getID());
|
||||
}
|
||||
// TODO: batch.setResourceTexture(0, _texture->getGPUTexture());
|
||||
} // TODO: else {
|
||||
// TODO: batch.setResourceTexture(0, args->_whiteTexture);
|
||||
// TODO: }
|
||||
|
||||
// TODO: batch.setViewTransform(Transform());
|
||||
|
||||
const float MAX_COLOR = 255.0f;
|
||||
xColor color = getColor();
|
||||
float alpha = getAlpha();
|
||||
glm::vec4 quadColor(color.red / MAX_COLOR, color.green / MAX_COLOR, color.blue / MAX_COLOR, alpha);
|
||||
// TODO: batch._glUniform4fv(colorLoc, 1, (const float*) &quadColor);
|
||||
|
||||
int left = _bounds.left();
|
||||
int right = _bounds.right() + 1;
|
||||
|
@ -75,6 +107,12 @@ void ImageOverlay::render(RenderArgs* args) {
|
|||
glm::vec2 topLeft(left, top);
|
||||
glm::vec2 bottomRight(right, bottom);
|
||||
|
||||
// TODO: Transform model;
|
||||
// TODO: model.setTranslation(glm::vec3(0.5f * (right + left), 0.5f * (top + bottom), 0.0f));
|
||||
// TODO: model.setScale(glm::vec3(0.5f * (right - left), 0.5f * (bottom - top), 1.0f));
|
||||
// TODO: batch.setModelTransform(model);
|
||||
|
||||
|
||||
// if for some reason our image is not over 0 width or height, don't attempt to render the image
|
||||
if (_renderImage) {
|
||||
float imageWidth = _texture->getWidth();
|
||||
|
@ -104,15 +142,24 @@ void ImageOverlay::render(RenderArgs* args) {
|
|||
|
||||
glm::vec2 texCoordTopLeft(x, y);
|
||||
glm::vec2 texCoordBottomRight(x + w, y + h);
|
||||
glm::vec4 texcoordRect(texCoordTopLeft, w, h);
|
||||
|
||||
// TODO: batch._glUniform4fv(texcoordRectLoc, 1, (const float*) &texcoordRect);
|
||||
// TODO: batch.draw(gpu::TRIANGLE_STRIP, 4);
|
||||
DependencyManager::get<GeometryCache>()->renderQuad(topLeft, bottomRight, texCoordTopLeft, texCoordBottomRight, quadColor);
|
||||
} else {
|
||||
// TODO: batch.draw(gpu::TRIANGLE_STRIP, 4);
|
||||
DependencyManager::get<GeometryCache>()->renderQuad(topLeft, bottomRight, quadColor);
|
||||
}
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
} else {
|
||||
// TODO: batch.draw(gpu::TRIANGLE_STRIP, 4);
|
||||
DependencyManager::get<GeometryCache>()->renderQuad(topLeft, bottomRight, quadColor);
|
||||
}
|
||||
|
||||
// TODO: if (!args->_batch) {
|
||||
// TODO: args->_context->render(batch);
|
||||
// TODO: }
|
||||
}
|
||||
|
||||
void ImageOverlay::setProperties(const QScriptValue& properties) {
|
||||
|
|
|
@ -115,7 +115,9 @@ void Overlays::renderHUD(RenderArgs* renderArgs) {
|
|||
thisOverlay->render(renderArgs);
|
||||
}
|
||||
}
|
||||
gpu::GLBackend::renderBatch(batch, true);
|
||||
|
||||
renderArgs->_context->syncCache();
|
||||
renderArgs->_context->render(batch);
|
||||
}
|
||||
|
||||
unsigned int Overlays::addOverlay(const QString& type, const QScriptValue& properties) {
|
||||
|
|
|
@ -35,14 +35,13 @@ void Rectangle3DOverlay::render(RenderArgs* args) {
|
|||
if (!_visible) {
|
||||
return; // do nothing if we're not visible
|
||||
}
|
||||
|
||||
|
||||
float alpha = getAlpha();
|
||||
xColor color = getColor();
|
||||
const float MAX_COLOR = 255.0f;
|
||||
glm::vec4 rectangleColor(color.red / MAX_COLOR, color.green / MAX_COLOR, color.blue / MAX_COLOR, alpha);
|
||||
|
||||
glm::vec3 position = getPosition();
|
||||
glm::vec3 center = getCenter();
|
||||
glm::vec2 dimensions = getDimensions();
|
||||
glm::vec2 halfDimensions = dimensions * 0.5f;
|
||||
glm::quat rotation = getRotation();
|
||||
|
@ -67,7 +66,7 @@ void Rectangle3DOverlay::render(RenderArgs* args) {
|
|||
glm::vec3 point2(halfDimensions.x, -halfDimensions.y, 0.0f);
|
||||
glm::vec3 point3(halfDimensions.x, halfDimensions.y, 0.0f);
|
||||
glm::vec3 point4(-halfDimensions.x, halfDimensions.y, 0.0f);
|
||||
|
||||
|
||||
geometryCache->renderDashedLine(*batch, point1, point2, rectangleColor);
|
||||
geometryCache->renderDashedLine(*batch, point2, point3, rectangleColor);
|
||||
geometryCache->renderDashedLine(*batch, point3, point4, rectangleColor);
|
||||
|
|
|
@ -93,16 +93,18 @@ void EntityTreeRenderer::clear() {
|
|||
foreach (const EntityItemID& entityID, _entityScripts.keys()) {
|
||||
checkAndCallUnload(entityID);
|
||||
}
|
||||
OctreeRenderer::clear();
|
||||
_entityScripts.clear();
|
||||
|
||||
auto scene = _viewState->getMain3DScene();
|
||||
render::PendingChanges pendingChanges;
|
||||
|
||||
foreach(auto entity, _entitiesInScene) {
|
||||
entity->removeFromScene(entity, scene, pendingChanges);
|
||||
}
|
||||
scene->enqueuePendingChanges(pendingChanges);
|
||||
_entitiesInScene.clear();
|
||||
|
||||
OctreeRenderer::clear();
|
||||
}
|
||||
|
||||
void EntityTreeRenderer::init() {
|
||||
|
@ -803,7 +805,7 @@ void EntityTreeRenderer::connectSignalsToSlots(EntityScriptingInterface* entityS
|
|||
connect(this, &EntityTreeRenderer::leaveEntity, entityScriptingInterface, &EntityScriptingInterface::leaveEntity);
|
||||
connect(this, &EntityTreeRenderer::collisionWithEntity, entityScriptingInterface, &EntityScriptingInterface::collisionWithEntity);
|
||||
|
||||
connect(&(*DependencyManager::get<SceneScriptingInterface>()), &SceneScriptingInterface::shouldRenderEntitiesChanged, this, &EntityTreeRenderer::updateEntityRenderStatus, Qt::QueuedConnection);
|
||||
connect(DependencyManager::get<SceneScriptingInterface>().data(), &SceneScriptingInterface::shouldRenderEntitiesChanged, this, &EntityTreeRenderer::updateEntityRenderStatus, Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
QScriptValueList EntityTreeRenderer::createMouseEventArgs(const EntityItemID& entityID, QMouseEvent* event, unsigned int deviceID) {
|
||||
|
@ -1003,7 +1005,7 @@ void EntityTreeRenderer::deletingEntity(const EntityItemID& entityID) {
|
|||
checkAndCallUnload(entityID);
|
||||
}
|
||||
_entityScripts.remove(entityID);
|
||||
|
||||
|
||||
// here's where we remove the entity payload from the scene
|
||||
if (_entitiesInScene.contains(entityID)) {
|
||||
auto entity = _entitiesInScene.take(entityID);
|
||||
|
@ -1164,6 +1166,7 @@ void EntityTreeRenderer::updateEntityRenderStatus(bool shouldRenderEntities) {
|
|||
} else {
|
||||
_entityIDsLastInScene = _entitiesInScene.keys();
|
||||
for (auto entityID : _entityIDsLastInScene) {
|
||||
// FIXME - is this really right? do we want to do the deletingEntity() code or just remove from the scene.
|
||||
deletingEntity(entityID);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -189,6 +189,7 @@ void makeEntityItemStatusGetters(RenderableModelEntityItem* entity, render::Item
|
|||
|
||||
bool RenderableModelEntityItem::addToScene(EntityItemPointer self, std::shared_ptr<render::Scene> scene,
|
||||
render::PendingChanges& pendingChanges) {
|
||||
|
||||
_myMetaItem = scene->allocateID();
|
||||
|
||||
auto renderData = RenderableModelEntityItemMeta::Pointer(new RenderableModelEntityItemMeta(self));
|
||||
|
@ -199,7 +200,10 @@ bool RenderableModelEntityItem::addToScene(EntityItemPointer self, std::shared_p
|
|||
if (_model) {
|
||||
render::Item::Status::Getters statusGetters;
|
||||
makeEntityItemStatusGetters(this, statusGetters);
|
||||
return _model->addToScene(scene, pendingChanges, statusGetters);
|
||||
|
||||
// note: we don't care if the model fails to add items, we always added our meta item and therefore we return
|
||||
// true so that the system knows our meta item is in the scene!
|
||||
_model->addToScene(scene, pendingChanges, statusGetters);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -385,7 +385,7 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
|
|||
dataAt += encodedID.size();
|
||||
bytesRead += encodedID.size();
|
||||
Q_ASSERT(id == _id);
|
||||
Q_ASSERT(parser.offset() == bytesRead);
|
||||
Q_ASSERT(parser.offset() == (unsigned int) bytesRead);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -400,7 +400,7 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
|
|||
quint32 type = typeCoder;
|
||||
EntityTypes::EntityType oldType = (EntityTypes::EntityType)type;
|
||||
Q_ASSERT(oldType == _type);
|
||||
Q_ASSERT(parser.offset() == bytesRead);
|
||||
Q_ASSERT(parser.offset() == (unsigned int) bytesRead);
|
||||
#endif
|
||||
|
||||
bool overwriteLocalData = true; // assume the new content overwrites our local data
|
||||
|
@ -417,7 +417,7 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
|
|||
dataAt += sizeof(createdFromBuffer2);
|
||||
bytesRead += sizeof(createdFromBuffer2);
|
||||
Q_ASSERT(createdFromBuffer2 == createdFromBuffer);
|
||||
Q_ASSERT(parser.offset() == bytesRead);
|
||||
Q_ASSERT(parser.offset() == (unsigned int) bytesRead);
|
||||
}
|
||||
#endif
|
||||
if (_created == UNKNOWN_CREATED_TIME) {
|
||||
|
@ -458,7 +458,7 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
|
|||
dataAt += sizeof(lastEditedFromBuffer2);
|
||||
bytesRead += sizeof(lastEditedFromBuffer2);
|
||||
Q_ASSERT(lastEditedFromBuffer2 == lastEditedFromBuffer);
|
||||
Q_ASSERT(parser.offset() == bytesRead);
|
||||
Q_ASSERT(parser.offset() == (unsigned int) bytesRead);
|
||||
}
|
||||
#endif
|
||||
quint64 lastEditedFromBufferAdjusted = lastEditedFromBuffer - clockSkew;
|
||||
|
@ -534,7 +534,7 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
|
|||
encodedUpdateDelta = updateDeltaCoder; // determine true length
|
||||
dataAt += encodedUpdateDelta.size();
|
||||
bytesRead += encodedUpdateDelta.size();
|
||||
Q_ASSERT(parser.offset() == bytesRead);
|
||||
Q_ASSERT(parser.offset() == (unsigned int) bytesRead);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -562,7 +562,7 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
|
|||
encodedSimulatedDelta = simulatedDeltaCoder; // determine true length
|
||||
dataAt += encodedSimulatedDelta.size();
|
||||
bytesRead += encodedSimulatedDelta.size();
|
||||
Q_ASSERT(parser.offset() == bytesRead);
|
||||
Q_ASSERT(parser.offset() == (unsigned int) bytesRead);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -599,7 +599,7 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
|
|||
dataAt += propertyFlags.getEncodedLength();
|
||||
bytesRead += propertyFlags.getEncodedLength();
|
||||
Q_ASSERT(propertyFlags2 == propertyFlags);
|
||||
Q_ASSERT(parser.offset() == bytesRead);
|
||||
Q_ASSERT(parser.offset() == (unsigned int)bytesRead);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
22
libraries/gpu/src/gpu/DrawColoredTexture.slf
Executable file
22
libraries/gpu/src/gpu/DrawColoredTexture.slf
Executable file
|
@ -0,0 +1,22 @@
|
|||
<@include gpu/Config.slh@>
|
||||
<$VERSION_HEADER$>
|
||||
// Generated on <$_SCRIBE_DATE$>
|
||||
//
|
||||
// Draw texture 0 fetched at texcoord.xy, Blend with color uniform
|
||||
//
|
||||
// Created by Sam Gateau on 7/12/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
|
||||
//
|
||||
|
||||
|
||||
uniform sampler2D colorMap;
|
||||
uniform vec4 color;
|
||||
|
||||
varying vec2 varTexcoord;
|
||||
|
||||
void main(void) {
|
||||
gl_FragColor = texture2D(colorMap, varTexcoord) * color;
|
||||
}
|
39
libraries/gpu/src/gpu/DrawTexcoordRectTransformUnitQuad.slv
Executable file
39
libraries/gpu/src/gpu/DrawTexcoordRectTransformUnitQuad.slv
Executable file
|
@ -0,0 +1,39 @@
|
|||
<@include gpu/Config.slh@>
|
||||
<$VERSION_HEADER$>
|
||||
// Generated on <$_SCRIBE_DATE$>
|
||||
//
|
||||
// Draw and transform the unit quad [-1,-1 -> 1,1]
|
||||
// Transform the normalized texcoords [0, 1] to be in the range [texcoordRect.xy, texcoordRect.xy + texcoordRect.zw]
|
||||
// Simply draw a Triangle_strip of 2 triangles, no input buffers or index buffer needed
|
||||
//
|
||||
// Created by Sam Gateau on 6/22/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()$>
|
||||
|
||||
uniform vec4 texcoordRect;
|
||||
|
||||
varying vec2 varTexcoord;
|
||||
|
||||
void main(void) {
|
||||
const vec4 UNIT_QUAD[4] = vec4[4](
|
||||
vec4(-1.0, -1.0, 0.0, 1.0),
|
||||
vec4(1.0, -1.0, 0.0, 1.0),
|
||||
vec4(-1.0, 1.0, 0.0, 1.0),
|
||||
vec4(1.0, 1.0, 0.0, 1.0)
|
||||
);
|
||||
vec4 pos = UNIT_QUAD[gl_VertexID];
|
||||
|
||||
// standard transform
|
||||
TransformCamera cam = getTransformCamera();
|
||||
TransformObject obj = getTransformObject();
|
||||
<$transformModelToClipPos(cam, obj, pos, gl_Position)$>
|
||||
|
||||
varTexcoord = ((pos.xy + 1) * 0.5) * texcoordRect.zw + texcoordRect.xy;
|
||||
}
|
|
@ -204,7 +204,6 @@ void GLBackend::do_drawInstanced(Batch& batch, uint32 paramOffset) {
|
|||
GLenum mode = _primitiveToGLmode[primitiveType];
|
||||
uint32 numVertices = batch._params[paramOffset + 2]._uint;
|
||||
uint32 startVertex = batch._params[paramOffset + 1]._uint;
|
||||
uint32 startInstance = batch._params[paramOffset + 0]._uint;
|
||||
|
||||
glDrawArraysInstancedARB(mode, startVertex, numVertices, numInstances);
|
||||
(void) CHECK_GL_ERROR();
|
||||
|
@ -238,7 +237,7 @@ void GLBackend::do_clearFramebuffer(Batch& batch, uint32 paramOffset) {
|
|||
|
||||
std::vector<GLenum> drawBuffers;
|
||||
if (masks & Framebuffer::BUFFER_COLORS) {
|
||||
for (int i = 0; i < Framebuffer::MAX_NUM_RENDER_BUFFERS; i++) {
|
||||
for (unsigned int i = 0; i < Framebuffer::MAX_NUM_RENDER_BUFFERS; i++) {
|
||||
if (masks & (1 << i)) {
|
||||
drawBuffers.push_back(GL_COLOR_ATTACHMENT0 + i);
|
||||
}
|
||||
|
|
|
@ -13,14 +13,46 @@
|
|||
#include "StandardShaderLib.h"
|
||||
|
||||
#include "DrawTransformUnitQuad_vert.h"
|
||||
#include "DrawTexcoordRectTransformUnitQuad_vert.h"
|
||||
#include "DrawViewportQuadTransformTexcoord_vert.h"
|
||||
#include "DrawTexture_frag.h"
|
||||
#include "DrawColoredTexture_frag.h"
|
||||
|
||||
using namespace gpu;
|
||||
|
||||
ShaderPointer StandardShaderLib::_drawTransformUnitQuadVS;
|
||||
ShaderPointer StandardShaderLib::_drawTexcoordRectTransformUnitQuadVS;
|
||||
ShaderPointer StandardShaderLib::_drawViewportQuadTransformTexcoordVS;
|
||||
ShaderPointer StandardShaderLib::_drawTexturePS;
|
||||
ShaderPointer StandardShaderLib::_drawColoredTexturePS;
|
||||
StandardShaderLib::ProgramMap StandardShaderLib::_programs;
|
||||
|
||||
ShaderPointer StandardShaderLib::getProgram(GetShader getVS, GetShader getPS) {
|
||||
|
||||
auto programIt = _programs.find(std::pair<GetShader, GetShader>(getVS, getPS));
|
||||
if (programIt != _programs.end()) {
|
||||
return (*programIt).second;
|
||||
} else {
|
||||
auto vs = (getVS)();
|
||||
auto ps = (getPS)();
|
||||
auto program = gpu::ShaderPointer(gpu::Shader::createProgram(vs, ps));
|
||||
if (program) {
|
||||
// Program created, let's try to make it
|
||||
if (gpu::Shader::makeProgram((*program))) {
|
||||
// All good, backup and return that program
|
||||
_programs.insert(ProgramMap::value_type(std::pair<GetShader, GetShader>(getVS, getPS), program));
|
||||
return program;
|
||||
} else {
|
||||
// Failed to make the program probably because vs and ps cannot work together?
|
||||
}
|
||||
} else {
|
||||
// Failed to create the program maybe because ps and vs are not true vertex and pixel shaders?
|
||||
}
|
||||
}
|
||||
return ShaderPointer();
|
||||
}
|
||||
|
||||
|
||||
|
||||
ShaderPointer StandardShaderLib::getDrawTransformUnitQuadVS() {
|
||||
if (!_drawTransformUnitQuadVS) {
|
||||
|
@ -29,6 +61,13 @@ ShaderPointer StandardShaderLib::getDrawTransformUnitQuadVS() {
|
|||
return _drawTransformUnitQuadVS;
|
||||
}
|
||||
|
||||
ShaderPointer StandardShaderLib::getDrawTexcoordRectTransformUnitQuadVS() {
|
||||
if (!_drawTexcoordRectTransformUnitQuadVS) {
|
||||
_drawTexcoordRectTransformUnitQuadVS = gpu::ShaderPointer(gpu::Shader::createVertex(std::string(DrawTexcoordRectTransformUnitQuad_vert)));
|
||||
}
|
||||
return _drawTexcoordRectTransformUnitQuadVS;
|
||||
}
|
||||
|
||||
ShaderPointer StandardShaderLib::getDrawViewportQuadTransformTexcoordVS() {
|
||||
if (!_drawViewportQuadTransformTexcoordVS) {
|
||||
_drawViewportQuadTransformTexcoordVS = gpu::ShaderPointer(gpu::Shader::createVertex(std::string(DrawViewportQuadTransformTexcoord_vert)));
|
||||
|
@ -42,3 +81,10 @@ ShaderPointer StandardShaderLib::getDrawTexturePS() {
|
|||
}
|
||||
return _drawTexturePS;
|
||||
}
|
||||
|
||||
ShaderPointer StandardShaderLib::getDrawColoredTexturePS() {
|
||||
if (!_drawColoredTexturePS) {
|
||||
_drawColoredTexturePS = gpu::ShaderPointer(gpu::Shader::createPixel(std::string(DrawColoredTexture_frag)));
|
||||
}
|
||||
return _drawColoredTexturePS;
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#define hifi_gpu_StandardShaderLib_h
|
||||
|
||||
#include <assert.h>
|
||||
#include <map>
|
||||
|
||||
#include "Shader.h"
|
||||
|
||||
|
@ -26,16 +27,30 @@ public:
|
|||
// A texcoord attribute is also generated texcoord = [(0,0),(1,1)]
|
||||
static ShaderPointer getDrawTransformUnitQuadVS();
|
||||
|
||||
// Shader draw the unit quad objectPos = ([(-1,-1),(1,1)]) and transform it by the full model transform stack (Model, View, Proj).
|
||||
// A texcoord attribute is also generated covering a rect defined from the uniform vec4 texcoordRect: texcoord = [texcoordRect.xy,texcoordRect.xy + texcoordRect.zw]
|
||||
static ShaderPointer getDrawTexcoordRectTransformUnitQuadVS();
|
||||
|
||||
// Shader draws the unit quad in the full viewport clipPos = ([(-1,-1),(1,1)]) and transform the texcoord = [(0,0),(1,1)] by the model transform.
|
||||
static ShaderPointer getDrawViewportQuadTransformTexcoordVS();
|
||||
|
||||
static ShaderPointer getDrawTexturePS();
|
||||
static ShaderPointer getDrawColoredTexturePS();
|
||||
|
||||
// The shader program combining the shaders available above, so they are unique
|
||||
typedef ShaderPointer (*GetShader) ();
|
||||
static ShaderPointer getProgram(GetShader vs, GetShader ps);
|
||||
|
||||
protected:
|
||||
|
||||
static ShaderPointer _drawTransformUnitQuadVS;
|
||||
static ShaderPointer _drawTexcoordRectTransformUnitQuadVS;
|
||||
static ShaderPointer _drawViewportQuadTransformTexcoordVS;
|
||||
static ShaderPointer _drawTexturePS;
|
||||
static ShaderPointer _drawColoredTexturePS;
|
||||
|
||||
typedef std::map<std::pair<GetShader, GetShader>, ShaderPointer> ProgramMap;
|
||||
static ProgramMap _programs;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -30,16 +30,6 @@ qint64 NLPacket::localHeaderSize() const {
|
|||
}
|
||||
|
||||
std::unique_ptr<NLPacket> NLPacket::create(PacketType::Value type, qint64 size) {
|
||||
auto maxPayload = maxPayloadSize(type);
|
||||
if (size == -1) {
|
||||
// default size of -1, means biggest packet possible
|
||||
size = maxPayload;
|
||||
}
|
||||
|
||||
// Fail with invalid size
|
||||
Q_ASSERT(size >= 0 || size < maxPayload);
|
||||
|
||||
// allocate memory
|
||||
return std::unique_ptr<NLPacket>(new NLPacket(type, size));
|
||||
}
|
||||
|
||||
|
|
|
@ -24,16 +24,6 @@ qint64 Packet::maxPayloadSize(PacketType::Value type) {
|
|||
}
|
||||
|
||||
std::unique_ptr<Packet> Packet::create(PacketType::Value type, qint64 size) {
|
||||
auto maxPayload = maxPayloadSize(type);
|
||||
if (size == -1) {
|
||||
// default size of -1, means biggest packet possible
|
||||
size = maxPayload;
|
||||
}
|
||||
|
||||
// Fail with invalid size
|
||||
Q_ASSERT(size >= 0 || size < maxPayload);
|
||||
|
||||
// allocate memory
|
||||
return std::unique_ptr<Packet>(new Packet(type, size));
|
||||
}
|
||||
|
||||
|
@ -65,8 +55,14 @@ Packet::Packet(PacketType::Value type, qint64 size) :
|
|||
_payloadStart(_packet.get() + localHeaderSize(_type)),
|
||||
_capacity(size)
|
||||
{
|
||||
auto maxPayload = maxPayloadSize(type);
|
||||
if (size == -1) {
|
||||
// default size of -1, means biggest packet possible
|
||||
size = maxPayload;
|
||||
}
|
||||
|
||||
// Sanity check
|
||||
Q_ASSERT(size <= maxPayloadSize(type));
|
||||
Q_ASSERT(size >= 0 || size < maxPayload);
|
||||
|
||||
// copy packet type and version in header
|
||||
writePacketTypeAndVersion(type);
|
||||
|
@ -94,6 +90,8 @@ Packet::Packet(const Packet& other) {
|
|||
}
|
||||
|
||||
Packet& Packet::operator=(const Packet& other) {
|
||||
_type = other._type;
|
||||
|
||||
_packetSize = other._packetSize;
|
||||
_packet = std::unique_ptr<char>(new char(_packetSize));
|
||||
memcpy(_packet.get(), other._packet.get(), _packetSize);
|
||||
|
@ -111,6 +109,8 @@ Packet::Packet(Packet&& other) {
|
|||
}
|
||||
|
||||
Packet& Packet::operator=(Packet&& other) {
|
||||
_type = other._type;
|
||||
|
||||
_packetSize = other._packetSize;
|
||||
_packet = std::move(other._packet);
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ void OctreeEditPacketSender::queuePacketToNode(const QUuid& nodeUUID, std::uniqu
|
|||
}
|
||||
|
||||
// add packet to history
|
||||
_sentPacketHistories[nodeUUID].packetSent(sequence, *packet.get());
|
||||
_sentPacketHistories[nodeUUID].packetSent(sequence, *packet);
|
||||
|
||||
queuePacketForSending(node, std::move(packet));
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ void OctreeEditPacketSender::queuePacketToNodes(std::unique_ptr<NLPacket> packet
|
|||
|
||||
if (isMyJurisdiction) {
|
||||
// make a copy of this packet for this node and queue
|
||||
auto packetCopy = NLPacket::createCopy(*packet.get());
|
||||
auto packetCopy = NLPacket::createCopy(*packet);
|
||||
queuePacketToNode(nodeUUID, std::move(packetCopy));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -189,7 +189,7 @@ void ObjectActionSpring::deserialize(QByteArray serializedArguments) {
|
|||
|
||||
EntityActionType type;
|
||||
dataStream >> type;
|
||||
assert(type == ACTION_TYPE_SPRING);
|
||||
assert(type == getType());
|
||||
|
||||
QUuid id;
|
||||
dataStream >> id;
|
||||
|
|
|
@ -114,9 +114,9 @@ void DeferredLightingEffect::init(AbstractViewStateInterface* viewState) {
|
|||
loadLightProgram(deferred_light_spot_vert, spot_light_frag, true, _spotLight, _spotLightLocations);
|
||||
|
||||
{
|
||||
auto VSFS = gpu::StandardShaderLib::getDrawViewportQuadTransformTexcoordVS();
|
||||
auto PSBlit = gpu::StandardShaderLib::getDrawTexturePS();
|
||||
auto blitProgram = gpu::ShaderPointer(gpu::Shader::createProgram(VSFS, PSBlit));
|
||||
//auto VSFS = gpu::StandardShaderLib::getDrawViewportQuadTransformTexcoordVS();
|
||||
//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());
|
||||
blitState->setBlendFunction(true,
|
||||
|
@ -474,17 +474,18 @@ void DeferredLightingEffect::render(RenderArgs* args) {
|
|||
// IN DEBUG: light->setShowContour(true);
|
||||
|
||||
batch.setUniformBuffer(_spotLightLocations.lightBufferUnit, light->getSchemaBuffer());
|
||||
|
||||
|
||||
auto eyeLightPos = eyePoint - light->getPosition();
|
||||
auto eyeHalfPlaneDistance = glm::dot(eyeLightPos, light->getDirection());
|
||||
|
||||
|
||||
const float TANGENT_LENGTH_SCALE = 0.666f;
|
||||
glm::vec4 coneParam(light->getSpotAngleCosSin(), TANGENT_LENGTH_SCALE * tan(0.5 * light->getSpotAngle()), 1.0f);
|
||||
glm::vec4 coneParam(light->getSpotAngleCosSin(), TANGENT_LENGTH_SCALE * tanf(0.5f * light->getSpotAngle()), 1.0f);
|
||||
|
||||
float expandedRadius = light->getMaximumRadius() * (1.0f + SCALE_EXPANSION);
|
||||
// TODO: We shouldn;t have to do that test and use a different volume geometry for when inside the vlight volume,
|
||||
// we should be able to draw thre same geometry use DepthClamp but for unknown reason it's s not working...
|
||||
if ((eyeHalfPlaneDistance > -nearRadius) && (glm::distance(eyePoint, glm::vec3(light->getPosition())) < expandedRadius + nearRadius)) {
|
||||
if ((eyeHalfPlaneDistance > -nearRadius) &&
|
||||
(glm::distance(eyePoint, glm::vec3(light->getPosition())) < expandedRadius + nearRadius)) {
|
||||
coneParam.w = 0.0f;
|
||||
batch._glUniform4fv(_spotLightLocations.coneParam, 1, reinterpret_cast< const GLfloat* >(&coneParam));
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ void Item::Status::Value::setColor(float hue) {
|
|||
}
|
||||
|
||||
void Item::Status::getPackedValues(glm::ivec4& values) const {
|
||||
for (unsigned int i = 0; i < values.length(); i++) {
|
||||
for (unsigned int i = 0; i < (unsigned int)values.length(); i++) {
|
||||
if (i < _values.size()) {
|
||||
values[i] = _values[i]().getPackedData();
|
||||
} else {
|
||||
|
|
|
@ -208,7 +208,7 @@ inline size_t PropertyFlags<Enum>::decode(const uint8_t* data, size_t size) {
|
|||
int bitAt = 0;
|
||||
int expectedBitCount; // unknown at this point
|
||||
int lastValueBit;
|
||||
for (int byte = 0; byte < size; byte++) {
|
||||
for (unsigned int byte = 0; byte < size; byte++) {
|
||||
char originalByte = data[byte];
|
||||
bytesConsumed++;
|
||||
unsigned char maskBit = 0x80; // LEFT MOST BIT set
|
||||
|
|
|
@ -73,15 +73,19 @@ template <typename T>
|
|||
void testByteCountCodedStable(const T& value) {
|
||||
ByteCountCoded<T> coder((T)value);
|
||||
auto encoded = coder.encode();
|
||||
#ifndef QT_NO_DEBUG
|
||||
auto originalEncodedSize = encoded.size();
|
||||
#endif
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
encoded.append(qrand());
|
||||
}
|
||||
ByteCountCoded<T> decoder;
|
||||
decoder.decode(encoded);
|
||||
Q_ASSERT(decoder.data == coder.data);
|
||||
#ifndef QT_NO_DEBUG
|
||||
auto consumed = decoder.decode(encoded.data(), encoded.size());
|
||||
Q_ASSERT(consumed == originalEncodedSize);
|
||||
#endif
|
||||
Q_ASSERT(consumed == (unsigned int)originalEncodedSize);
|
||||
|
||||
}
|
||||
|
||||
|
@ -100,12 +104,14 @@ void testPropertyFlags(uint32_t value) {
|
|||
EntityPropertyFlags original;
|
||||
original.clear();
|
||||
auto enumSize = sizeof(EntityPropertyList);
|
||||
for (size_t i = 0; i < sizeof(EntityPropertyList) * 8; ++i) {
|
||||
for (size_t i = 0; i < enumSize * 8; ++i) {
|
||||
original.setHasProperty((EntityPropertyList)i);
|
||||
}
|
||||
QByteArray encoded = original.encode();
|
||||
#ifndef QT_NO_DEBUG
|
||||
auto originalSize = encoded.size();
|
||||
for (size_t i = 0; i < sizeof(EntityPropertyList); ++i) {
|
||||
#endif
|
||||
for (size_t i = 0; i < enumSize; ++i) {
|
||||
encoded.append(qrand());
|
||||
}
|
||||
|
||||
|
@ -116,7 +122,9 @@ void testPropertyFlags(uint32_t value) {
|
|||
}
|
||||
|
||||
{
|
||||
#ifndef QT_NO_DEBUG
|
||||
auto decodeSize = decodeNew.decode((const uint8_t*)encoded.data(), encoded.size());
|
||||
#endif
|
||||
Q_ASSERT(originalSize == decodeSize);
|
||||
Q_ASSERT(decodeNew == original);
|
||||
}
|
||||
|
@ -129,7 +137,7 @@ void testPropertyFlags() {
|
|||
testPropertyFlags(0xFFFF);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int main(int argc, char** argv) {
|
||||
QCoreApplication app(argc, argv);
|
||||
{
|
||||
auto start = usecTimestampNow();
|
||||
|
|
Loading…
Reference in a new issue