Merge branch 'team-teaching' of https://github.com/highfidelity/hifi into lod

This commit is contained in:
Atlante45 2015-06-04 14:22:12 +02:00
commit 96be60c0cf
16 changed files with 89 additions and 52 deletions

View file

@ -42,6 +42,12 @@ panel.newSlider("Num Drawn Opaques", 0, 1000,
function(value) { return (value); }
);
panel.newSlider("Max Drawn Opaques", -1, 1000,
function(value) { Scene.setEngineMaxDrawnOpaqueItems(value); },
function() { return Scene.getEngineMaxDrawnOpaqueItems(); },
function(value) { return (value); }
);
panel.newCheckbox("Enable Cull Transparent",
function(value) { Scene.setEngineCullTransparent((value != 0)); },
function() { return Scene.doEngineCullTransparent(); },
@ -72,6 +78,12 @@ panel.newSlider("Num Drawn Transparents", 0, 1000,
function(value) { return (value); }
);
panel.newSlider("Max Drawn Transparents", -1, 1000,
function(value) { Scene.setEngineMaxDrawnTransparentItems(value); },
function() { return Scene.getEngineMaxDrawnTransparentItems(); },
function(value) { return (value); }
);
var tickTackPeriod = 500;
function updateCounters() {

View file

@ -22,6 +22,7 @@ Item {
property int animationDuration: hifi.effects.fadeInDuration
property bool destroyOnInvisible: false
property real scale: 1.25 // Make this dialog a little larger than normal
implicitWidth: addressBarDialog.implicitWidth
implicitHeight: addressBarDialog.implicitHeight
@ -41,9 +42,9 @@ Item {
id: backgroundImage
source: "../images/address-bar.svg"
width: 576
height: 80
property int inputAreaHeight: 56 // Height of the background's input area
width: 576 * root.scale
height: 80 * root.scale
property int inputAreaHeight: 56.0 * root.scale // Height of the background's input area
property int inputAreaStep: (height - inputAreaHeight) / 2
TextInput {
@ -58,7 +59,8 @@ Item {
}
font.pointSize: 15
font.pixelSize: hifi.fonts.pixelSize * root.scale
helperText: "Go to: place, @user, /path, network address"
onAccepted: {

View file

@ -9,7 +9,7 @@ Original.SpinBox {
style: SpinBoxStyle {
HifiConstants { id: hifi }
font.family: hifi.fonts.fontFamily
font.pointSize: hifi.fonts.fontSize
font.pixelSize: hifi.fonts.pixelSize
}
}

View file

@ -4,6 +4,6 @@ import "../styles"
Original.Text {
HifiConstants { id: hifi }
font.family: hifi.fonts.fontFamily
font.pointSize: hifi.fonts.fontSize
font.pixelSize: hifi.fonts.pixelSize
}

View file

@ -4,6 +4,6 @@ import "../styles"
Original.TextArea {
HifiConstants { id: hifi }
font.family: hifi.fonts.fontFamily
font.pointSize: hifi.fonts.fontSize
font.pixelSize: hifi.fonts.pixelSize
}

View file

@ -4,6 +4,6 @@ import "../styles"
Original.TextEdit {
HifiConstants { id: hifi }
font.family: hifi.fonts.fontFamily
font.pointSize: hifi.fonts.fontSize
font.pixelSize: hifi.fonts.pixelSize
}

View file

@ -4,6 +4,6 @@ import "../styles"
Text {
HifiConstants { id: hifi }
color: hifi.colors.hifiBlue
font.pointSize: hifi.fonts.headerPointSize
font.pixelSize: hifi.fonts.headerPixelSize
font.bold: true
}

View file

@ -11,7 +11,7 @@ Original.TextInput {
color: hifi.colors.text
verticalAlignment: Original.TextInput.AlignVCenter
font.family: hifi.fonts.fontFamily
font.pointSize: hifi.fonts.fontSize
font.pixelSize: hifi.fonts.pixelSize
/*
Original.Rectangle {
@ -23,7 +23,7 @@ Original.TextInput {
*/
Text {
anchors.fill: parent
font.pointSize: parent.font.pointSize
font.pixelSize: parent.font.pixelSize
font.family: parent.font.family
verticalAlignment: parent.verticalAlignment
horizontalAlignment: parent.horizontalAlignment

View file

@ -18,7 +18,7 @@ Item {
readonly property color background: sysPalette.dark
readonly property color text: sysPalette.text
readonly property color disabledText: "gray"
readonly property color hintText: sysPalette.dark
readonly property color hintText: "gray" // A bit darker than sysPalette.dark so that it is visible on the DK2
readonly property color light: sysPalette.light
readonly property alias activeWindow: activeWindow
readonly property alias inactiveWindow: inactiveWindow
@ -36,9 +36,9 @@ Item {
QtObject {
id: fonts
readonly property real headerPointSize: 24
readonly property string fontFamily: "Helvetica"
readonly property real fontSize: 18
readonly property string fontFamily: "Arial" // Available on both Windows and OSX
readonly property real pixelSize: 22 // Logical pixel size; works on Windows and OSX at varying physical DPIs
readonly property real headerPixelSize: 32
}
QtObject {

View file

@ -3191,7 +3191,7 @@ namespace render {
template <> void payloadRender(const WorldBoxRenderData::Pointer& stuff, RenderArgs* args) {
if (args->_renderMode != CAMERA_MODE_MIRROR && Menu::getInstance()->isOptionChecked(MenuOption::Stats)) {
PerformanceTimer perfTimer("worldBox");
renderWorldBox();
renderWorldBox(args);
// FIXME: there's currently a bug in the new render engine, if this origin dot is rendered out of view it will
// screw up the state of textures on models so they all end up rendering in the incorrect tint/color/texture
@ -3506,6 +3506,9 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se
renderContext._sortTransparent = sceneInterface->doEngineSortTransparent();
renderContext._renderTransparent = sceneInterface->doEngineRenderTransparent();
renderContext._maxDrawnOpaqueItems = sceneInterface->getEngineMaxDrawnOpaqueItems();
renderContext._maxDrawnTransparentItems = sceneInterface->getEngineMaxDrawnTransparentItems();
renderArgs->_shouldRender = LODManager::shouldRender;
renderContext.args = renderArgs;

View file

@ -33,9 +33,9 @@
using namespace std;
void renderWorldBox() {
return;
void renderWorldBox(RenderArgs* renderArgs) {
auto geometryCache = DependencyManager::get<GeometryCache>();
auto batch = renderArgs->_batch;
// Show edge of world
glm::vec3 red(1.0f, 0.0f, 0.0f);
@ -43,36 +43,32 @@ void renderWorldBox() {
glm::vec3 blue(0.0f, 0.0f, 1.0f);
glm::vec3 grey(0.5f, 0.5f, 0.5f);
glDisable(GL_LIGHTING);
glLineWidth(1.0);
geometryCache->renderLine(glm::vec3(0, 0, 0), glm::vec3(TREE_SCALE, 0, 0), red);
geometryCache->renderLine(glm::vec3(0, 0, 0), glm::vec3(0, TREE_SCALE, 0), green);
geometryCache->renderLine(glm::vec3(0, 0, 0), glm::vec3(0, 0, TREE_SCALE), blue);
geometryCache->renderLine(glm::vec3(0, 0, TREE_SCALE), glm::vec3(TREE_SCALE, 0, TREE_SCALE), grey);
geometryCache->renderLine(glm::vec3(TREE_SCALE, 0, TREE_SCALE), glm::vec3(TREE_SCALE, 0, 0), grey);
geometryCache->renderLine(*batch, glm::vec3(0, 0, 0), glm::vec3(TREE_SCALE, 0, 0), red);
geometryCache->renderLine(*batch, glm::vec3(0, 0, 0), glm::vec3(0, TREE_SCALE, 0), green);
geometryCache->renderLine(*batch, glm::vec3(0, 0, 0), glm::vec3(0, 0, TREE_SCALE), blue);
geometryCache->renderLine(*batch, glm::vec3(0, 0, TREE_SCALE), glm::vec3(TREE_SCALE, 0, TREE_SCALE), grey);
geometryCache->renderLine(*batch, glm::vec3(TREE_SCALE, 0, TREE_SCALE), glm::vec3(TREE_SCALE, 0, 0), grey);
// Draw meter markers along the 3 axis to help with measuring things
const float MARKER_DISTANCE = 1.0f;
const float MARKER_RADIUS = 0.05f;
glEnable(GL_LIGHTING);
glPushMatrix();
glTranslatef(MARKER_DISTANCE, 0, 0);
geometryCache->renderSphere(MARKER_RADIUS, 10, 10, red);
glPopMatrix();
glPushMatrix();
glTranslatef(0, MARKER_DISTANCE, 0);
geometryCache->renderSphere(MARKER_RADIUS, 10, 10, green);
glPopMatrix();
glPushMatrix();
glTranslatef(0, 0, MARKER_DISTANCE);
geometryCache->renderSphere(MARKER_RADIUS, 10, 10, blue);
glPopMatrix();
glPushMatrix();
glTranslatef(MARKER_DISTANCE, 0, MARKER_DISTANCE);
geometryCache->renderSphere(MARKER_RADIUS, 10, 10, grey);
glPopMatrix();
Transform transform;
transform.setTranslation(glm::vec3(MARKER_DISTANCE, 0, 0));
batch->setModelTransform(transform);
geometryCache->renderSphere(*batch, MARKER_RADIUS, 10, 10, red);
transform.setTranslation(glm::vec3(0, MARKER_DISTANCE, 0));
batch->setModelTransform(transform);
geometryCache->renderSphere(*batch, MARKER_RADIUS, 10, 10, green);
transform.setTranslation(glm::vec3(0, 0, MARKER_DISTANCE));
batch->setModelTransform(transform);
geometryCache->renderSphere(*batch, MARKER_RADIUS, 10, 10, blue);
transform.setTranslation(glm::vec3(MARKER_DISTANCE, 0, MARKER_DISTANCE));
batch->setModelTransform(transform);
geometryCache->renderSphere(*batch, MARKER_RADIUS, 10, 10, grey);
}
// Return a random vector of average length 1

View file

@ -16,10 +16,12 @@
#include <glm/gtc/quaternion.hpp>
#include <QSettings>
#include "RenderArgs.h"
float randFloat();
const glm::vec3 randVector();
void renderWorldBox();
void renderWorldBox(RenderArgs* renderArgs);
int widthText(float scale, int mono, char const* string);
void drawText(int x, int y, float scale, float radians, int mono,

View file

@ -156,14 +156,26 @@ void render::depthSortItems(const SceneContextPointer& sceneContext, const Rende
}
}
void render::renderItems(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemIDs& inItems) {
void render::renderItems(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemIDs& inItems, int maxDrawnItems) {
PerformanceTimer perfTimer("renderItems");
auto& scene = sceneContext->_scene;
RenderArgs* args = renderContext->args;
// render
for (auto id : inItems) {
auto item = scene->getItem(id);
item.render(args);
if ((maxDrawnItems < 0) || (maxDrawnItems > inItems.size())) {
for (auto id : inItems) {
auto item = scene->getItem(id);
item.render(args);
}
} else {
int numItems = 0;
for (auto id : inItems) {
auto item = scene->getItem(id);
item.render(args);
numItems++;
if (numItems >= maxDrawnItems) {
return;
}
}
}
}
@ -264,7 +276,7 @@ template <> void render::jobRun(const DrawOpaque& job, const SceneContextPointer
batch._glDrawBuffers(bufferCount, buffers);
}
renderItems(sceneContext, renderContext, renderedItems);
renderItems(sceneContext, renderContext, renderedItems, renderContext->_maxDrawnOpaqueItems);
args->_context->render((*args->_batch));
args->_batch = nullptr;
@ -331,7 +343,7 @@ template <> void render::jobRun(const DrawTransparent& job, const SceneContextPo
args->_alphaThreshold = MOSTLY_OPAQUE_THRESHOLD;
}
renderItems(sceneContext, renderContext, renderedItems);
renderItems(sceneContext, renderContext, renderedItems, renderContext->_maxDrawnTransparentItems);
{
GLenum buffers[3];
@ -342,7 +354,7 @@ template <> void render::jobRun(const DrawTransparent& job, const SceneContextPo
}
renderItems(sceneContext, renderContext, renderedItems);
renderItems(sceneContext, renderContext, renderedItems, renderContext->_maxDrawnTransparentItems);
args->_context->render((*args->_batch));
args->_batch = nullptr;

View file

@ -59,7 +59,7 @@ typedef std::vector<Job> Jobs;
void cullItems(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemIDs& inItems, ItemIDs& outITems);
void depthSortItems(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, bool frontToBack, const ItemIDs& inItems, ItemIDs& outITems);
void renderItems(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemIDs& inItems);
void renderItems(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemIDs& inItems, int maxDrawnItems = -1);
class DrawOpaque {

View file

@ -39,9 +39,11 @@ public:
int _numFeedOpaqueItems = 0;
int _numDrawnOpaqueItems = 0;
int _maxDrawnOpaqueItems = -1;
int _numFeedTransparentItems = 0;
int _numDrawnTransparentItems = 0;
int _maxDrawnTransparentItems = -1;
RenderContext() {}
};

View file

@ -96,6 +96,10 @@ public:
void setEngineFeedTransparentItems(int count) { _numFeedTransparentItems = count; }
Q_INVOKABLE int getEngineNumFeedTransparentItems() { return _numFeedTransparentItems; }
Q_INVOKABLE void setEngineMaxDrawnOpaqueItems(int count) { _maxDrawnOpaqueItems = count; }
Q_INVOKABLE int getEngineMaxDrawnOpaqueItems() { return _maxDrawnOpaqueItems; }
Q_INVOKABLE void setEngineMaxDrawnTransparentItems(int count) { _maxDrawnTransparentItems = count; }
Q_INVOKABLE int getEngineMaxDrawnTransparentItems() { return _maxDrawnTransparentItems; }
signals:
void shouldRenderAvatarsChanged(bool shouldRenderAvatars);
@ -120,6 +124,10 @@ protected:
int _numDrawnOpaqueItems = 0;
int _numFeedTransparentItems = 0;
int _numDrawnTransparentItems = 0;
int _maxDrawnOpaqueItems = -1;
int _maxDrawnTransparentItems = -1;
};
#endif // hifi_SceneScriptingInterface_h