mirror of
https://github.com/overte-org/overte.git
synced 2025-04-19 15:43:50 +02:00
commit
5ab97d0228
12 changed files with 63 additions and 49 deletions
|
@ -109,9 +109,6 @@ void Avatar::simulate(float deltaTime) {
|
|||
_shouldRenderBillboard = true;
|
||||
}
|
||||
|
||||
// copy velocity so we can use it later for acceleration
|
||||
glm::vec3 oldVelocity = getVelocity();
|
||||
|
||||
getHand()->simulate(deltaTime, false);
|
||||
_skeletonModel.setLODDistance(getLODDistance());
|
||||
|
||||
|
@ -192,7 +189,7 @@ void Avatar::render(bool forShadowMap) {
|
|||
{
|
||||
// glow when moving in the distance
|
||||
|
||||
const float GLOW_DISTANCE = 5.0f;
|
||||
const float GLOW_DISTANCE = 20.0f;
|
||||
Glower glower(_moving && lengthToTarget > GLOW_DISTANCE && !forShadowMap ? 1.0f : 0.0f);
|
||||
|
||||
// render body
|
||||
|
|
|
@ -146,7 +146,7 @@ void SkeletonModel::applyPalmData(int jointIndex, const QVector<int>& fingerJoin
|
|||
|
||||
// rotate palm according to average finger direction
|
||||
float directionLength = glm::length(direction);
|
||||
const int MIN_ROTATION_FINGERS = 3;
|
||||
const unsigned int MIN_ROTATION_FINGERS = 3;
|
||||
if (directionLength > EPSILON && palm.getNumFingers() >= MIN_ROTATION_FINGERS) {
|
||||
applyRotationDelta(jointIndex, rotationBetween(palmRotation * glm::vec3(-sign, 0.0f, 0.0f), direction), false);
|
||||
getJointRotation(jointIndex, palmRotation, true);
|
||||
|
|
|
@ -60,7 +60,7 @@ void SixenseManager::update(float deltaTime) {
|
|||
// Either find a palm matching the sixense controller, or make a new one
|
||||
PalmData* palm;
|
||||
bool foundHand = false;
|
||||
for (int j = 0; j < hand->getNumPalms(); j++) {
|
||||
for (size_t j = 0; j < hand->getNumPalms(); j++) {
|
||||
if (hand->getPalms()[j].getSixenseID() == data.controller_index) {
|
||||
palm = &(hand->getPalms()[j]);
|
||||
foundHand = true;
|
||||
|
@ -128,7 +128,7 @@ void SixenseManager::update(float deltaTime) {
|
|||
}
|
||||
|
||||
// if the controllers haven't been moved in a while, disable
|
||||
const int MOVEMENT_DISABLE_DURATION = 30 * 1000 * 1000;
|
||||
const unsigned int MOVEMENT_DISABLE_DURATION = 30 * 1000 * 1000;
|
||||
if (usecTimestampNow() - _lastMovement > MOVEMENT_DISABLE_DURATION) {
|
||||
for (vector<PalmData>::iterator it = hand->getPalms().begin(); it != hand->getPalms().end(); it++) {
|
||||
it->setActive(false);
|
||||
|
|
|
@ -66,7 +66,7 @@ template<class T> QVariant readBinaryArray(QDataStream& in) {
|
|||
in >> compressedLength;
|
||||
|
||||
QVector<T> values;
|
||||
const int DEFLATE_ENCODING = 1;
|
||||
const unsigned int DEFLATE_ENCODING = 1;
|
||||
if (encoding == DEFLATE_ENCODING) {
|
||||
// preface encoded data with uncompressed length
|
||||
QByteArray compressed(sizeof(quint32) + compressedLength, 0);
|
||||
|
@ -163,7 +163,7 @@ FBXNode parseBinaryFBXNode(QDataStream& in) {
|
|||
in >> nameLength;
|
||||
|
||||
FBXNode node;
|
||||
const int MIN_VALID_OFFSET = 40;
|
||||
const unsigned int MIN_VALID_OFFSET = 40;
|
||||
if (endOffset < MIN_VALID_OFFSET || nameLength == 0) {
|
||||
// use a null name to indicate a null node
|
||||
return node;
|
||||
|
|
|
@ -328,6 +328,8 @@ bool Model::render(float alpha) {
|
|||
|
||||
glDisable(GL_COLOR_MATERIAL);
|
||||
|
||||
glEnable(GL_CULL_FACE);
|
||||
|
||||
// render opaque meshes with alpha testing
|
||||
|
||||
glEnable(GL_ALPHA_TEST);
|
||||
|
@ -339,8 +341,6 @@ bool Model::render(float alpha) {
|
|||
|
||||
// render translucent meshes afterwards, with back face culling
|
||||
|
||||
glEnable(GL_CULL_FACE);
|
||||
|
||||
renderMeshes(alpha, true);
|
||||
|
||||
glDisable(GL_CULL_FACE);
|
||||
|
|
|
@ -387,7 +387,7 @@ void BoxSetTool::render() {
|
|||
|
||||
glm::quat rotation = _editor->getGridRotation();
|
||||
glm::vec3 axis = glm::axis(rotation);
|
||||
glRotatef(glm::angle(rotation), axis.x, axis.y, axis.z);
|
||||
glRotatef(glm::degrees(glm::angle(rotation)), axis.x, axis.y, axis.z);
|
||||
|
||||
glm::quat inverseRotation = glm::inverse(rotation);
|
||||
glm::vec3 rayOrigin = inverseRotation * Application::getInstance()->getMouseRayOrigin();
|
||||
|
|
|
@ -155,27 +155,27 @@ Attribute::Attribute(const QString& name) :
|
|||
Attribute::~Attribute() {
|
||||
}
|
||||
|
||||
void Attribute::read(MetavoxelData& data, MetavoxelStreamState& state) {
|
||||
void Attribute::readMetavoxelRoot(MetavoxelData& data, MetavoxelStreamState& state) {
|
||||
data.createRoot(state.attribute)->read(state);
|
||||
}
|
||||
|
||||
void Attribute::write(const MetavoxelNode& root, MetavoxelStreamState& state) {
|
||||
void Attribute::writeMetavoxelRoot(const MetavoxelNode& root, MetavoxelStreamState& state) {
|
||||
root.write(state);
|
||||
}
|
||||
|
||||
void Attribute::readDelta(MetavoxelData& data, const MetavoxelNode& reference, MetavoxelStreamState& state) {
|
||||
void Attribute::readMetavoxelDelta(MetavoxelData& data, const MetavoxelNode& reference, MetavoxelStreamState& state) {
|
||||
data.createRoot(state.attribute)->readDelta(reference, state);
|
||||
}
|
||||
|
||||
void Attribute::writeDelta(const MetavoxelNode& root, const MetavoxelNode& reference, MetavoxelStreamState& state) {
|
||||
void Attribute::writeMetavoxelDelta(const MetavoxelNode& root, const MetavoxelNode& reference, MetavoxelStreamState& state) {
|
||||
root.writeDelta(reference, state);
|
||||
}
|
||||
|
||||
void Attribute::readSubdivision(MetavoxelData& data, MetavoxelStreamState& state) {
|
||||
void Attribute::readMetavoxelSubdivision(MetavoxelData& data, MetavoxelStreamState& state) {
|
||||
data.getRoot(state.attribute)->readSubdivision(state);
|
||||
}
|
||||
|
||||
void Attribute::writeSubdivision(const MetavoxelNode& root, MetavoxelStreamState& state) {
|
||||
void Attribute::writeMetavoxelSubdivision(const MetavoxelNode& root, MetavoxelStreamState& state) {
|
||||
root.writeSubdivision(state);
|
||||
}
|
||||
|
||||
|
@ -327,7 +327,7 @@ SpannerSetAttribute::SpannerSetAttribute(const QString& name, const QMetaObject*
|
|||
SharedObjectSetAttribute(name, metaObject) {
|
||||
}
|
||||
|
||||
void SpannerSetAttribute::read(MetavoxelData& data, MetavoxelStreamState& state) {
|
||||
void SpannerSetAttribute::readMetavoxelRoot(MetavoxelData& data, MetavoxelStreamState& state) {
|
||||
forever {
|
||||
SharedObjectPointer object;
|
||||
state.stream >> object;
|
||||
|
@ -338,13 +338,14 @@ void SpannerSetAttribute::read(MetavoxelData& data, MetavoxelStreamState& state)
|
|||
}
|
||||
}
|
||||
|
||||
void SpannerSetAttribute::write(const MetavoxelNode& root, MetavoxelStreamState& state) {
|
||||
void SpannerSetAttribute::writeMetavoxelRoot(const MetavoxelNode& root, MetavoxelStreamState& state) {
|
||||
Spanner::incrementVisit();
|
||||
root.writeSpanners(state);
|
||||
state.stream << SharedObjectPointer();
|
||||
}
|
||||
|
||||
void SpannerSetAttribute::readDelta(MetavoxelData& data, const MetavoxelNode& reference, MetavoxelStreamState& state) {
|
||||
void SpannerSetAttribute::readMetavoxelDelta(MetavoxelData& data,
|
||||
const MetavoxelNode& reference, MetavoxelStreamState& state) {
|
||||
forever {
|
||||
SharedObjectPointer object;
|
||||
state.stream >> object;
|
||||
|
@ -355,13 +356,14 @@ void SpannerSetAttribute::readDelta(MetavoxelData& data, const MetavoxelNode& re
|
|||
}
|
||||
}
|
||||
|
||||
void SpannerSetAttribute::writeDelta(const MetavoxelNode& root, const MetavoxelNode& reference, MetavoxelStreamState& state) {
|
||||
void SpannerSetAttribute::writeMetavoxelDelta(const MetavoxelNode& root,
|
||||
const MetavoxelNode& reference, MetavoxelStreamState& state) {
|
||||
Spanner::incrementVisit();
|
||||
root.writeSpannerDelta(reference, state);
|
||||
state.stream << SharedObjectPointer();
|
||||
}
|
||||
|
||||
void SpannerSetAttribute::readSubdivision(MetavoxelData& data, MetavoxelStreamState& state) {
|
||||
void SpannerSetAttribute::readMetavoxelSubdivision(MetavoxelData& data, MetavoxelStreamState& state) {
|
||||
forever {
|
||||
SharedObjectPointer object;
|
||||
state.stream >> object;
|
||||
|
@ -372,7 +374,7 @@ void SpannerSetAttribute::readSubdivision(MetavoxelData& data, MetavoxelStreamSt
|
|||
}
|
||||
}
|
||||
|
||||
void SpannerSetAttribute::writeSubdivision(const MetavoxelNode& root, MetavoxelStreamState& state) {
|
||||
void SpannerSetAttribute::writeMetavoxelSubdivision(const MetavoxelNode& root, MetavoxelStreamState& state) {
|
||||
Spanner::incrementVisit();
|
||||
root.writeSpannerSubdivision(state);
|
||||
state.stream << SharedObjectPointer();
|
||||
|
|
|
@ -177,14 +177,14 @@ public:
|
|||
virtual void readDelta(Bitstream& in, void*& value, void* reference, bool isLeaf) const { read(in, value, isLeaf); }
|
||||
virtual void writeDelta(Bitstream& out, void* value, void* reference, bool isLeaf) const { write(out, value, isLeaf); }
|
||||
|
||||
virtual void read(MetavoxelData& data, MetavoxelStreamState& state);
|
||||
virtual void write(const MetavoxelNode& root, MetavoxelStreamState& state);
|
||||
virtual void readMetavoxelRoot(MetavoxelData& data, MetavoxelStreamState& state);
|
||||
virtual void writeMetavoxelRoot(const MetavoxelNode& root, MetavoxelStreamState& state);
|
||||
|
||||
virtual void readDelta(MetavoxelData& data, const MetavoxelNode& reference, MetavoxelStreamState& state);
|
||||
virtual void writeDelta(const MetavoxelNode& root, const MetavoxelNode& reference, MetavoxelStreamState& state);
|
||||
virtual void readMetavoxelDelta(MetavoxelData& data, const MetavoxelNode& reference, MetavoxelStreamState& state);
|
||||
virtual void writeMetavoxelDelta(const MetavoxelNode& root, const MetavoxelNode& reference, MetavoxelStreamState& state);
|
||||
|
||||
virtual void readSubdivision(MetavoxelData& data, MetavoxelStreamState& state);
|
||||
virtual void writeSubdivision(const MetavoxelNode& root, MetavoxelStreamState& state);
|
||||
virtual void readMetavoxelSubdivision(MetavoxelData& data, MetavoxelStreamState& state);
|
||||
virtual void writeMetavoxelSubdivision(const MetavoxelNode& root, MetavoxelStreamState& state);
|
||||
|
||||
virtual bool equal(void* first, void* second) const = 0;
|
||||
|
||||
|
@ -265,7 +265,7 @@ template<class T, int bits> inline bool SimpleInlineAttribute<T, bits>::merge(vo
|
|||
/// Provides appropriate averaging for RGBA values.
|
||||
class QRgbAttribute : public InlineAttribute<QRgb> {
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(int defaultValue MEMBER _defaultValue)
|
||||
Q_PROPERTY(uint defaultValue MEMBER _defaultValue)
|
||||
|
||||
public:
|
||||
|
||||
|
@ -355,14 +355,14 @@ public:
|
|||
Q_INVOKABLE SpannerSetAttribute(const QString& name = QString(),
|
||||
const QMetaObject* metaObject = &SharedObject::staticMetaObject);
|
||||
|
||||
virtual void read(MetavoxelData& data, MetavoxelStreamState& state);
|
||||
virtual void write(const MetavoxelNode& root, MetavoxelStreamState& state);
|
||||
virtual void readMetavoxelRoot(MetavoxelData& data, MetavoxelStreamState& state);
|
||||
virtual void writeMetavoxelRoot(const MetavoxelNode& root, MetavoxelStreamState& state);
|
||||
|
||||
virtual void readDelta(MetavoxelData& data, const MetavoxelNode& reference, MetavoxelStreamState& state);
|
||||
virtual void writeDelta(const MetavoxelNode& root, const MetavoxelNode& reference, MetavoxelStreamState& state);
|
||||
virtual void readMetavoxelDelta(MetavoxelData& data, const MetavoxelNode& reference, MetavoxelStreamState& state);
|
||||
virtual void writeMetavoxelDelta(const MetavoxelNode& root, const MetavoxelNode& reference, MetavoxelStreamState& state);
|
||||
|
||||
virtual void readSubdivision(MetavoxelData& data, MetavoxelStreamState& state);
|
||||
virtual void writeSubdivision(const MetavoxelNode& root, MetavoxelStreamState& state);
|
||||
virtual void readMetavoxelSubdivision(MetavoxelData& data, MetavoxelStreamState& state);
|
||||
virtual void writeMetavoxelSubdivision(const MetavoxelNode& root, MetavoxelStreamState& state);
|
||||
};
|
||||
|
||||
#endif /* defined(__interface__AttributeRegistry__) */
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
REGISTER_SIMPLE_TYPE_STREAMER(bool)
|
||||
REGISTER_SIMPLE_TYPE_STREAMER(int)
|
||||
REGISTER_SIMPLE_TYPE_STREAMER(uint)
|
||||
REGISTER_SIMPLE_TYPE_STREAMER(float)
|
||||
REGISTER_SIMPLE_TYPE_STREAMER(QByteArray)
|
||||
REGISTER_SIMPLE_TYPE_STREAMER(QColor)
|
||||
|
@ -238,6 +239,17 @@ Bitstream& Bitstream::operator>>(int& value) {
|
|||
return *this;
|
||||
}
|
||||
|
||||
Bitstream& Bitstream::operator<<(uint value) {
|
||||
return write(&value, 32);
|
||||
}
|
||||
|
||||
Bitstream& Bitstream::operator>>(uint& value) {
|
||||
quint32 sizedValue;
|
||||
read(&sizedValue, 32);
|
||||
value = sizedValue;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Bitstream& Bitstream::operator<<(float value) {
|
||||
return write(&value, 32);
|
||||
}
|
||||
|
|
|
@ -254,6 +254,9 @@ public:
|
|||
Bitstream& operator<<(int value);
|
||||
Bitstream& operator>>(int& value);
|
||||
|
||||
Bitstream& operator<<(uint value);
|
||||
Bitstream& operator>>(uint& value);
|
||||
|
||||
Bitstream& operator<<(float value);
|
||||
Bitstream& operator>>(float& value);
|
||||
|
||||
|
|
|
@ -228,7 +228,7 @@ public:
|
|||
Spanner* getSpanner() const { return _spanner; }
|
||||
float getDistance() const { return _distance; }
|
||||
|
||||
virtual bool visit(Spanner* spanner, float distance);
|
||||
virtual bool visitSpanner(Spanner* spanner, float distance);
|
||||
|
||||
private:
|
||||
|
||||
|
@ -243,7 +243,7 @@ FirstRaySpannerIntersectionVisitor::FirstRaySpannerIntersectionVisitor(
|
|||
_spanner(NULL) {
|
||||
}
|
||||
|
||||
bool FirstRaySpannerIntersectionVisitor::visit(Spanner* spanner, float distance) {
|
||||
bool FirstRaySpannerIntersectionVisitor::visitSpanner(Spanner* spanner, float distance) {
|
||||
_spanner = spanner;
|
||||
_distance = distance;
|
||||
return false;
|
||||
|
@ -312,7 +312,7 @@ void MetavoxelData::read(Bitstream& in, const MetavoxelLOD& lod) {
|
|||
break;
|
||||
}
|
||||
MetavoxelStreamState state = { getMinimum(), _size, attribute, in, lod, lod };
|
||||
attribute->read(*this, state);
|
||||
attribute->readMetavoxelRoot(*this, state);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -321,7 +321,7 @@ void MetavoxelData::write(Bitstream& out, const MetavoxelLOD& lod) const {
|
|||
for (QHash<AttributePointer, MetavoxelNode*>::const_iterator it = _roots.constBegin(); it != _roots.constEnd(); it++) {
|
||||
out << it.key();
|
||||
MetavoxelStreamState state = { getMinimum(), _size, it.key(), out, lod, lod };
|
||||
it.key()->write(*it.value(), state);
|
||||
it.key()->writeMetavoxelRoot(*it.value(), state);
|
||||
}
|
||||
out << AttributePointer();
|
||||
}
|
||||
|
@ -360,13 +360,13 @@ void MetavoxelData::readDelta(const MetavoxelData& reference, const MetavoxelLOD
|
|||
in >> changed;
|
||||
if (changed) {
|
||||
oldRoot->incrementReferenceCount();
|
||||
attribute->readDelta(*this, *oldRoot, state);
|
||||
attribute->readMetavoxelDelta(*this, *oldRoot, state);
|
||||
oldRoot->decrementReferenceCount(attribute);
|
||||
} else {
|
||||
attribute->readSubdivision(*this, state);
|
||||
attribute->readMetavoxelSubdivision(*this, state);
|
||||
}
|
||||
} else {
|
||||
attribute->read(*this, state);
|
||||
attribute->readMetavoxelRoot(*this, state);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -415,13 +415,13 @@ void MetavoxelData::writeDelta(const MetavoxelData& reference, const MetavoxelLO
|
|||
if (referenceRoot) {
|
||||
if (it.value() == referenceRoot) {
|
||||
out << false;
|
||||
it.key()->writeSubdivision(*it.value(), state);
|
||||
it.key()->writeMetavoxelSubdivision(*it.value(), state);
|
||||
} else {
|
||||
out << true;
|
||||
it.key()->writeDelta(*it.value(), *referenceRoot, state);
|
||||
it.key()->writeMetavoxelDelta(*it.value(), *referenceRoot, state);
|
||||
}
|
||||
} else {
|
||||
it.key()->write(*it.value(), state);
|
||||
it.key()->writeMetavoxelRoot(*it.value(), state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -938,7 +938,7 @@ int RaySpannerIntersectionVisitor::visit(MetavoxelInfo& info, float distance) {
|
|||
}
|
||||
qStableSort(spannerDistances);
|
||||
foreach (const SpannerDistance& spannerDistance, spannerDistances) {
|
||||
if (!visit(spannerDistance.spanner, spannerDistance.distance)) {
|
||||
if (!visitSpanner(spannerDistance.spanner, spannerDistance.distance)) {
|
||||
return SHORT_CIRCUIT;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -302,7 +302,7 @@ public:
|
|||
|
||||
/// Visits a spanner that the ray intersects.
|
||||
/// \return true to continue, false to short-circuit the tour
|
||||
virtual bool visit(Spanner* spanner, float distance) = 0;
|
||||
virtual bool visitSpanner(Spanner* spanner, float distance) = 0;
|
||||
|
||||
virtual void prepare();
|
||||
virtual int visit(MetavoxelInfo& info, float distance);
|
||||
|
|
Loading…
Reference in a new issue