mirror of
https://github.com/overte-org/overte.git
synced 2025-04-06 22:32:57 +02:00
more ui test features
This commit is contained in:
parent
916d8c4522
commit
2008c61368
8 changed files with 128 additions and 13 deletions
|
@ -66,7 +66,7 @@ void GameSpaceToRender::run(const workload::WorkloadContextPointer& runContext,
|
|||
if (!render::Item::isValidID(_spaceRenderItemID)) {
|
||||
_spaceRenderItemID = scene->allocateID();
|
||||
auto renderItem = std::make_shared<GameWorkloadRenderItem>();
|
||||
renderItem->editBound().setBox(glm::vec3(0.0f), 32000.0f);
|
||||
renderItem->editBound().setBox(glm::vec3(-16000.0f), 16000.0f);
|
||||
renderItem->setAllProxies(proxies);
|
||||
transaction.resetItem(_spaceRenderItemID, std::make_shared<GameWorkloadRenderItem::Payload>(renderItem));
|
||||
}
|
||||
|
|
|
@ -16,6 +16,10 @@
|
|||
|
||||
using namespace workload;
|
||||
|
||||
void RegionState::configure(const Config& config) {
|
||||
}
|
||||
|
||||
|
||||
void RegionState::run(const workload::WorkloadContextPointer& renderContext, const Inputs& inputs) {
|
||||
// inputs is a vector of vectors of proxyId's:
|
||||
//
|
||||
|
@ -66,4 +70,7 @@ void RegionState::run(const workload::WorkloadContextPointer& renderContext, con
|
|||
oldState.swap(newState);
|
||||
}
|
||||
}
|
||||
|
||||
auto config = std::static_pointer_cast<Config>(renderContext->jobConfig);
|
||||
config->setNum(0, _state[0].size(), _state[1].size(), _state[2].size());
|
||||
}
|
||||
|
|
|
@ -19,16 +19,45 @@
|
|||
#include "Engine.h"
|
||||
|
||||
namespace workload {
|
||||
class RegionStateConfig : public Job::Config{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(float numR0 READ getNumR0 NOTIFY dirty)
|
||||
Q_PROPERTY(float numR1 READ getNumR1 NOTIFY dirty)
|
||||
Q_PROPERTY(float numR2 READ getNumR2 NOTIFY dirty)
|
||||
Q_PROPERTY(float numR3 READ getNumR3 NOTIFY dirty)
|
||||
public:
|
||||
|
||||
uint32_t getNumR0() const { return data.numR0; }
|
||||
uint32_t getNumR1() const { return data.numR1; }
|
||||
uint32_t getNumR2() const { return data.numR2; }
|
||||
uint32_t getNumR3() const { return data.numR3; }
|
||||
|
||||
void setNum(const uint32_t r0, const uint32_t r1, const uint32_t r2, const uint32_t r3) {
|
||||
data.numR0 = r0; data.numR1 = r1; data.numR2 = r2; data.numR3 = r3; emit dirty();
|
||||
}
|
||||
|
||||
struct Data {
|
||||
uint32_t numR0{ 0 };
|
||||
uint32_t numR1{ 0 };
|
||||
uint32_t numR2{ 0 };
|
||||
uint32_t numR3{ 0 };
|
||||
} data;
|
||||
|
||||
signals:
|
||||
void dirty();
|
||||
};
|
||||
|
||||
class RegionState {
|
||||
public:
|
||||
using Config = RegionStateConfig;
|
||||
using Inputs = IndexVectors;
|
||||
using JobModel = workload::Job::ModelI<RegionState, Inputs>;
|
||||
using JobModel = workload::Job::ModelI<RegionState, Inputs, Config>;
|
||||
|
||||
RegionState() {
|
||||
_state.resize(Region::UNKNOWN);
|
||||
}
|
||||
|
||||
void configure(const Config& config);
|
||||
void run(const workload::WorkloadContextPointer& renderContext, const Inputs& inputs);
|
||||
|
||||
protected:
|
||||
|
|
|
@ -41,6 +41,18 @@ void SetupViews::run(const WorkloadContextPointer& renderContext, const Input& i
|
|||
usedViews[0].makeHorizontal();
|
||||
}
|
||||
|
||||
// Force frutum orientation horizontal if needed
|
||||
if (usedViews.size() > 0 && data.simulateSecondaryCamera) {
|
||||
auto view = usedViews[0];
|
||||
auto secondaryDirectionFlat = glm::normalize(glm::vec3(view.direction.x, 0.0f, view.direction.z));
|
||||
auto secondaryDirection = glm::normalize(glm::vec3(secondaryDirectionFlat.z, 0.0f, -secondaryDirectionFlat.x));
|
||||
|
||||
view.origin += -30.0f * secondaryDirection;
|
||||
view.direction = -secondaryDirectionFlat;
|
||||
|
||||
usedViews.insert(usedViews.begin() + 1, view);
|
||||
}
|
||||
|
||||
// Update regions based on the current config
|
||||
for (auto& v : usedViews) {
|
||||
View::updateRegions(v, (float*) &data);
|
||||
|
|
|
@ -25,6 +25,8 @@ namespace workload {
|
|||
Q_PROPERTY(bool freezeViews READ getFreezeView WRITE setFreezeView NOTIFY dirty)
|
||||
Q_PROPERTY(bool useAvatarView READ useAvatarView WRITE setUseAvatarView NOTIFY dirty)
|
||||
Q_PROPERTY(bool forceViewHorizontal READ forceViewHorizontal WRITE setForceViewHorizontal NOTIFY dirty)
|
||||
|
||||
Q_PROPERTY(bool simulateSecondaryCamera READ simulateSecondaryCamera WRITE setSimulateSecondaryCamera NOTIFY dirty)
|
||||
public:
|
||||
|
||||
|
||||
|
@ -49,6 +51,9 @@ namespace workload {
|
|||
bool forceViewHorizontal() const { return data.forceViewHorizontal; }
|
||||
void setForceViewHorizontal(bool use) { data.forceViewHorizontal = use; emit dirty(); }
|
||||
|
||||
bool simulateSecondaryCamera() const { return data.simulateSecondaryCamera; }
|
||||
void setSimulateSecondaryCamera(bool use) { data.simulateSecondaryCamera = use; emit dirty(); }
|
||||
|
||||
struct Data {
|
||||
float r1Back { 2.0f };
|
||||
float r1Front { 10.0f };
|
||||
|
@ -62,6 +67,7 @@ namespace workload {
|
|||
bool freezeViews{ false };
|
||||
bool useAvatarView{ false };
|
||||
bool forceViewHorizontal{ false };
|
||||
bool simulateSecondaryCamera{ false };
|
||||
} data;
|
||||
|
||||
signals:
|
||||
|
|
|
@ -17,7 +17,8 @@
|
|||
|
||||
var GRID_DROP_C = GRID_WORLD_DROP_HEIGHT / TILE_UNIT;
|
||||
|
||||
function updateWorldResolution(res) {
|
||||
function updateWorldSizeAndResolution(size, res) {
|
||||
GRID_WORLD_SIZE = size
|
||||
GRID_WORLD_RESOLUTION = res;
|
||||
|
||||
GRID_SIZE = GRID_WORLD_RESOLUTION;
|
||||
|
@ -155,8 +156,8 @@ function addZone(hasKeyLight, hasAmbient, lifetime) {
|
|||
|
||||
function addTestScene(name, lifetime) {
|
||||
var scene = [];
|
||||
scene.push(addFloor(lifetime));
|
||||
scene.push(addZone(true, true, lifetime));
|
||||
// scene.push(addFloor(lifetime));
|
||||
// scene.push(addZone(true, true, lifetime));
|
||||
|
||||
addObjectGrid(scene, lifetime);
|
||||
|
||||
|
@ -213,13 +214,22 @@ clearScene = function() {
|
|||
}
|
||||
|
||||
changeResolution = function(res) {
|
||||
updateWorldResolution(res);
|
||||
updateWorldSizeAndResolution(GRID_WORLD_SIZE, res);
|
||||
}
|
||||
|
||||
getResolution = function() {
|
||||
return GRID_WORLD_RESOLUTION;
|
||||
}
|
||||
|
||||
changeSize = function(size) {
|
||||
updateWorldSizeAndResolution(size, GRID_WORLD_RESOLUTION);
|
||||
}
|
||||
|
||||
getSize = function() {
|
||||
return GRID_WORLD_SIZE;
|
||||
}
|
||||
|
||||
|
||||
getNumObjects = function() {
|
||||
return GRID_SIZE * GRID_SIZE;
|
||||
}
|
||||
|
|
|
@ -87,15 +87,19 @@
|
|||
switch (message.method) {
|
||||
case "createScene":
|
||||
createScene();
|
||||
sendToQml({method: "objectCount", params: { v: getNumObjects() }})
|
||||
updateGridInQML()
|
||||
break;
|
||||
case "clearScene":
|
||||
clearScene();
|
||||
sendToQml({method: "objectCount", params: { v: getNumObjects() }})
|
||||
updateGridInQML()
|
||||
break;
|
||||
case "changeSize":
|
||||
changeSize(message.params.count);
|
||||
updateGridInQML()
|
||||
break;
|
||||
case "changeResolution":
|
||||
changeResolution(message.params.count);
|
||||
sendToQml({method: "objectCount", params: { v: getNumObjects() }})
|
||||
updateGridInQML()
|
||||
break;
|
||||
case "bumpUpFloor":
|
||||
bumpUpFloor();
|
||||
|
@ -103,10 +107,14 @@
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
sendToQml({method: "objectCount", params: { v: getNumObjects() }})
|
||||
function updateGridInQML() {
|
||||
sendToQml({method: "gridSize", params: { v: getSize() }})
|
||||
sendToQml({method: "objectCount", params: { v: getNumObjects() }})
|
||||
}
|
||||
|
||||
function sendToQml(message) {
|
||||
tablet.sendToQml(message);
|
||||
}
|
||||
|
||||
updateGridInQML()
|
||||
}());
|
|
@ -35,6 +35,10 @@ Rectangle {
|
|||
sendToScript({method: "clearScene", params: { count:2 }});
|
||||
}
|
||||
|
||||
function broadcastChangeSize(value) {
|
||||
sendToScript({method: "changeSize", params: { count:value }});
|
||||
}
|
||||
|
||||
function broadcastChangeResolution(value) {
|
||||
sendToScript({method: "changeResolution", params: { count:value }});
|
||||
}
|
||||
|
@ -45,10 +49,15 @@ Rectangle {
|
|||
|
||||
function fromScript(message) {
|
||||
switch (message.method) {
|
||||
case "gridSize":
|
||||
print("assigned value! " + message.params.v)
|
||||
gridSizeLabel.text = ("Grid size [m] = " + message.params.v)
|
||||
gridSize.setValue(message.params.v)
|
||||
break;
|
||||
case "resolution":
|
||||
print("assigned value! " + message.params.v)
|
||||
resolution.setValue(message.params.v)
|
||||
break;
|
||||
break;
|
||||
case "objectCount":
|
||||
print("assigned objectCount! " + message.params.v)
|
||||
objectCount.text = ("Num objects = " + message.params.v)
|
||||
|
@ -90,6 +99,17 @@ Rectangle {
|
|||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
HifiControls.CheckBox {
|
||||
boxSize: 20
|
||||
text: "Simulate Secondary"
|
||||
checked: Workload.getConfig("setupViews")["simulateSecondaryCamera"]
|
||||
onCheckedChanged: { Workload.getConfig("setupViews")["simulateSecondaryCamera"] = checked; }
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
@ -148,6 +168,10 @@ Rectangle {
|
|||
}
|
||||
}
|
||||
}
|
||||
Separator {}
|
||||
HifiControls.Label {
|
||||
text: "Numbers: R2= " + Workload.getConfig("regionState")["numR2"];
|
||||
}
|
||||
Separator {}
|
||||
HifiControls.Label {
|
||||
text: "Display"
|
||||
|
@ -193,7 +217,26 @@ Rectangle {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
HifiControls.Label {
|
||||
id: gridSizeLabel
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
text: "Grid side size [m]"
|
||||
}
|
||||
HifiControls.Slider {
|
||||
id: gridSize
|
||||
stepSize: 1.0
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 0
|
||||
anchors.topMargin: 0
|
||||
minimumValue: 1
|
||||
maximumValue: 200
|
||||
value: 100
|
||||
|
||||
onValueChanged: { _workload.broadcastChangeSize(value) }
|
||||
}
|
||||
|
||||
HifiControls.Label {
|
||||
id: objectCount
|
||||
anchors.left: parent.left
|
||||
|
|
Loading…
Reference in a new issue