mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 02:23:38 +02:00
Ray intersections for models, don't load resources if there's no network
manager installed.
This commit is contained in:
parent
78957e42be
commit
ae6a59ef78
5 changed files with 23 additions and 4 deletions
|
@ -360,6 +360,10 @@ void StaticModelRenderer::render(float alpha) {
|
||||||
_model->render(alpha);
|
_model->render(alpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool StaticModelRenderer::findRayIntersection(const glm::vec3& origin, const glm::vec3& direction, float& distance) const {
|
||||||
|
return _model->findRayIntersection(origin, direction, distance);
|
||||||
|
}
|
||||||
|
|
||||||
void StaticModelRenderer::applyTranslation(const glm::vec3& translation) {
|
void StaticModelRenderer::applyTranslation(const glm::vec3& translation) {
|
||||||
_model->setTranslation(translation);
|
_model->setTranslation(translation);
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,6 +163,7 @@ public:
|
||||||
virtual void init(Spanner* spanner);
|
virtual void init(Spanner* spanner);
|
||||||
virtual void simulate(float deltaTime);
|
virtual void simulate(float deltaTime);
|
||||||
virtual void render(float alpha);
|
virtual void render(float alpha);
|
||||||
|
virtual bool findRayIntersection(const glm::vec3& origin, const glm::vec3& direction, float& distance) const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
|
|
|
@ -1177,9 +1177,9 @@ AttributeValue MetavoxelVisitation::getInheritedOutputValue(int index) const {
|
||||||
const float DEFAULT_GRANULARITY = 0.01f;
|
const float DEFAULT_GRANULARITY = 0.01f;
|
||||||
|
|
||||||
Spanner::Spanner() :
|
Spanner::Spanner() :
|
||||||
|
_renderer(NULL),
|
||||||
_granularity(DEFAULT_GRANULARITY),
|
_granularity(DEFAULT_GRANULARITY),
|
||||||
_lastVisit(0),
|
_lastVisit(0) {
|
||||||
_renderer(NULL) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Spanner::setBounds(const Box& bounds) {
|
void Spanner::setBounds(const Box& bounds) {
|
||||||
|
@ -1247,6 +1247,10 @@ void SpannerRenderer::render(float alpha) {
|
||||||
// nothing by default
|
// nothing by default
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SpannerRenderer::findRayIntersection(const glm::vec3& origin, const glm::vec3& direction, float& distance) const {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
Transformable::Transformable() : _scale(1.0f) {
|
Transformable::Transformable() : _scale(1.0f) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1359,6 +1363,12 @@ void StaticModel::setURL(const QUrl& url) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool StaticModel::findRayIntersection(const glm::vec3& origin, const glm::vec3& direction, float& distance) const {
|
||||||
|
// delegate to renderer, if we have one
|
||||||
|
return _renderer ? _renderer->findRayIntersection(origin, direction, distance) :
|
||||||
|
Spanner::findRayIntersection(origin, direction, distance);
|
||||||
|
}
|
||||||
|
|
||||||
QByteArray StaticModel::getRendererClassName() const {
|
QByteArray StaticModel::getRendererClassName() const {
|
||||||
return "StaticModelRenderer";
|
return "StaticModelRenderer";
|
||||||
}
|
}
|
||||||
|
|
|
@ -444,6 +444,8 @@ signals:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
SpannerRenderer* _renderer;
|
||||||
|
|
||||||
/// Returns the name of the class to instantiate in order to render this spanner.
|
/// Returns the name of the class to instantiate in order to render this spanner.
|
||||||
virtual QByteArray getRendererClassName() const;
|
virtual QByteArray getRendererClassName() const;
|
||||||
|
|
||||||
|
@ -452,7 +454,6 @@ private:
|
||||||
Box _bounds;
|
Box _bounds;
|
||||||
float _granularity;
|
float _granularity;
|
||||||
int _lastVisit; ///< the identifier of the last visit
|
int _lastVisit; ///< the identifier of the last visit
|
||||||
SpannerRenderer* _renderer;
|
|
||||||
|
|
||||||
static int _visit; ///< the global visit counter
|
static int _visit; ///< the global visit counter
|
||||||
};
|
};
|
||||||
|
@ -468,6 +469,7 @@ public:
|
||||||
virtual void init(Spanner* spanner);
|
virtual void init(Spanner* spanner);
|
||||||
virtual void simulate(float deltaTime);
|
virtual void simulate(float deltaTime);
|
||||||
virtual void render(float alpha);
|
virtual void render(float alpha);
|
||||||
|
virtual bool findRayIntersection(const glm::vec3& origin, const glm::vec3& direction, float& distance) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// An object with a 3D transform.
|
/// An object with a 3D transform.
|
||||||
|
@ -550,6 +552,8 @@ public:
|
||||||
void setURL(const QUrl& url);
|
void setURL(const QUrl& url);
|
||||||
const QUrl& getURL() const { return _url; }
|
const QUrl& getURL() const { return _url; }
|
||||||
|
|
||||||
|
virtual bool findRayIntersection(const glm::vec3& origin, const glm::vec3& direction, float& distance) const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
void urlChanged(const QUrl& url);
|
void urlChanged(const QUrl& url);
|
||||||
|
|
|
@ -81,7 +81,7 @@ Resource::Resource(const QUrl& url, bool delayLoad) :
|
||||||
_reply(NULL),
|
_reply(NULL),
|
||||||
_attempts(0) {
|
_attempts(0) {
|
||||||
|
|
||||||
if (!url.isValid()) {
|
if (!(url.isValid() && ResourceCache::getNetworkAccessManager())) {
|
||||||
_startedLoading = _failedToLoad = true;
|
_startedLoading = _failedToLoad = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue