mirror of
https://github.com/lubosz/overte.git
synced 2025-04-24 21:23:18 +02:00
fix compile errors and add PhysicsBoundary.cpp file
This commit is contained in:
parent
ed1761945c
commit
da48a5af20
2 changed files with 40 additions and 29 deletions
34
interface/src/workload/PhysicsBoundary.cpp
Normal file
34
interface/src/workload/PhysicsBoundary.cpp
Normal file
|
@ -0,0 +1,34 @@
|
|||
//
|
||||
// PhysicsBoundary.h
|
||||
//
|
||||
// Created by Andrew Meadows 2018.04.05
|
||||
// Copyright 2018 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 "PhysicsBoundary.h"
|
||||
|
||||
#include <PhysicsLogging.h>
|
||||
#include <workload/Space.h>
|
||||
|
||||
#include "workload/GameWorkload.h"
|
||||
|
||||
void PhysicsBoundary::run(const workload::WorkloadContextPointer& context, const Inputs& inputs) {
|
||||
auto space = context->_space;
|
||||
if (!space) {
|
||||
return;
|
||||
}
|
||||
GameWorkloadContext* gameContext = static_cast<GameWorkloadContext*>(context.get());
|
||||
PhysicalEntitySimulationPointer simulation = gameContext->_simulation;
|
||||
const auto& regionChanges = inputs.get0();
|
||||
for (uint32_t i = 0; i < (uint32_t)regionChanges.size(); ++i) {
|
||||
const workload::Space::Change& change = regionChanges[i];
|
||||
auto entity = space->getOwner(change.proxyId).get<EntityItemPointer>();
|
||||
if (entity) {
|
||||
simulation->changeEntity(entity);
|
||||
qCDebug(physics) << change.proxyId << " : " << "'" << entity->getName() << "' " << (uint32_t)(change.prevRegion) << " --> " << (uint32_t)(change.region);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// PhysicsBoundary.h
|
||||
//
|
||||
// Created by Sam Gateau on 2/16/2018.
|
||||
// Created by Andrew Meadows 2018.04.05
|
||||
// Copyright 2018 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
|
@ -10,13 +10,10 @@
|
|||
#ifndef hifi_PhysicsGatekeeper_h
|
||||
#define hifi_PhysicsGatekeeper_h
|
||||
|
||||
#include "workload/Space.h"
|
||||
#include "workload/Engine.h"
|
||||
|
||||
#include "render/Scene.h"
|
||||
|
||||
#include <workload/RegionTracker.h>
|
||||
#include <EntityItem.h>
|
||||
#include <workload/Engine.h>
|
||||
#include <workload/RegionTracker.h>
|
||||
|
||||
#include "PhysicalEntitySimulation.h"
|
||||
|
||||
class PhysicsBoundary {
|
||||
|
@ -27,28 +24,8 @@ public:
|
|||
using JobModel = workload::Job::ModelI<PhysicsBoundary, Inputs, Config>; // this doesn't work
|
||||
|
||||
PhysicsBoundary() {}
|
||||
|
||||
void configure(const Config& config) {
|
||||
}
|
||||
|
||||
void run(const workload::WorkloadContextPointer& context, const Inputs& inputs) {
|
||||
auto space = context->_space;
|
||||
if (!space) {
|
||||
return;
|
||||
}
|
||||
GameWorkloadContext* gameContext = static_cast<GameWorkloadContext*>(context.get());
|
||||
PhysicalEntitySimulationPointer simulation = gameContext->_simulation;
|
||||
const auto& regionChanges = inputs.get0();
|
||||
for (uint32_t i = 0; i < (uint32_t)regionChanges.size(); ++i) {
|
||||
const workload::Space::Change& change = regionChanges[i];
|
||||
auto entity = space->getOwner(change.proxyId).get<EntityItemPointer>();
|
||||
if (entity) {
|
||||
simulation->changeEntity(entity);
|
||||
qCDebug("physics") << change.proxyId << " : " << "'" << entity->getName() << "' "
|
||||
<< (uint32_t)(change.prevRegion) << " --> " << (uint32_t)(change.region);
|
||||
}
|
||||
}
|
||||
}
|
||||
void configure(const Config& config) { }
|
||||
void run(const workload::WorkloadContextPointer& context, const Inputs& inputs);
|
||||
};
|
||||
|
||||
#endif // hifi_PhysicsGatekeeper_h
|
||||
|
|
Loading…
Reference in a new issue