mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-02 11:13:43 +02:00
checkpoint
This commit is contained in:
parent
0d9f0f609b
commit
4bdeef7610
6 changed files with 109 additions and 43 deletions
|
@ -1189,17 +1189,3 @@ void EntityTreeRenderer::entityCollisionWithEntity(const EntityItemID& idA, cons
|
||||||
entityScriptB.property("collisionWithEntity").call(entityScriptA, args);
|
entityScriptB.property("collisionWithEntity").call(entityScriptA, args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <> const render::Item::Key render::payloadGetKey(const RenderableEnitityItem* payload) {
|
|
||||||
return payload->getKey();
|
|
||||||
}
|
|
||||||
|
|
||||||
template <> const render::Item::Bound render::payloadGetBound(const RenderableEnitityItem* payload) {
|
|
||||||
return payload->getBounds();
|
|
||||||
}
|
|
||||||
|
|
||||||
template <> void render::payloadRender(const RenderableEnitityItem* payload, Context& context, RenderArgs* args) {
|
|
||||||
return payload->render(context, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -191,32 +191,5 @@ private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class RenderableEnitityItem {
|
|
||||||
public:
|
|
||||||
RenderableEnitityItem(EntityItem* entity) {
|
|
||||||
_entity = entity;
|
|
||||||
}
|
|
||||||
|
|
||||||
const render::Item::Key& getKey() const {
|
|
||||||
_myKey.set(render::Item::TYPE_SHAPE);
|
|
||||||
return _myKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
const render::Item::Bound getBounds() const {
|
|
||||||
return _entity->getAABox();
|
|
||||||
}
|
|
||||||
|
|
||||||
void render(render::Context& context, RenderArgs* args) const {
|
|
||||||
_entity->render(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
mutable render::Item::Key _myKey;
|
|
||||||
EntityItem* _entity = nullptr;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef render::Payload<RenderableEnitityItem> RenderableEnitityItemPayload;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // hifi_EntityTreeRenderer_h
|
#endif // hifi_EntityTreeRenderer_h
|
||||||
|
|
30
libraries/entities-renderer/src/RenderableEntityItem.cpp
Normal file
30
libraries/entities-renderer/src/RenderableEntityItem.cpp
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
//
|
||||||
|
// RenderableEntityItem.cpp
|
||||||
|
// interface/src
|
||||||
|
//
|
||||||
|
// Created by Brad Hefta-Gaub on 12/6/13.
|
||||||
|
// Copyright 2013 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 "RenderableEntityItem.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
template <> const render::ItemKey render::payloadGetKey(const std::shared_ptr<RenderableEntityItem>& payload) {
|
||||||
|
return payload->getKey();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <> const render::Item::Bound render::payloadGetBound(const std::shared_ptr<RenderableEntityItem>& payload) {
|
||||||
|
return payload->getBounds();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <> void render::payloadRender(const std::shared_ptr<RenderableEntityItem>& payload, RenderArgs* args) {
|
||||||
|
return payload->render(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
76
libraries/entities-renderer/src/RenderableEntityItem.h
Normal file
76
libraries/entities-renderer/src/RenderableEntityItem.h
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
//
|
||||||
|
// RenderableEntityItem.h
|
||||||
|
// interface/src
|
||||||
|
//
|
||||||
|
// Created by Brad Hefta-Gaub on 12/6/13.
|
||||||
|
// Copyright 2013 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
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef hifi_RenderableEntityItem_h
|
||||||
|
#define hifi_RenderableEntityItem_h
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
#include <render/Scene.h>
|
||||||
|
#include <EntityItem.h>
|
||||||
|
|
||||||
|
class RenderableEntityItemProxy {
|
||||||
|
public:
|
||||||
|
RenderableEntityItemProxy(EntityItem* entity) {
|
||||||
|
_entity = entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
const render::ItemKey& getKey() const {
|
||||||
|
_myKey = render::ItemKey::Builder().withTypeShape().build();
|
||||||
|
return _myKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
const render::Item::Bound getBounds() const {
|
||||||
|
if (_entity) {
|
||||||
|
return _entity->getAABox();
|
||||||
|
}
|
||||||
|
return render::Item::Bound();
|
||||||
|
}
|
||||||
|
|
||||||
|
void render(RenderArgs* args) const {
|
||||||
|
if (_entity) {
|
||||||
|
_entity->render(args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void clearEntity() {
|
||||||
|
_entity = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
mutable render::ItemKey _myKey;
|
||||||
|
EntityItem* _entity = nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef render::Payload<RenderableEntityItemProxy> RenderableEntityItemProxyPayload;
|
||||||
|
|
||||||
|
class RenderableEntityItem {
|
||||||
|
public:
|
||||||
|
~RenderableEntityItem() {
|
||||||
|
if (_proxy) {
|
||||||
|
_proxy->clearEntity();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RenderableEntityItemProxy* getRenderProxy() {
|
||||||
|
if (!_proxy) {
|
||||||
|
//_proxy = new RenderableEntityItemProxy(this);
|
||||||
|
}
|
||||||
|
return _proxy;
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
RenderableEntityItemProxy* _proxy = nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#endif // hifi_RenderableEntityItem_h
|
|
@ -424,4 +424,7 @@ protected:
|
||||||
bool _simulated; // set by EntitySimulation
|
bool _simulated; // set by EntitySimulation
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef std::shared_ptr<EntityItem> EntityItemSharedPointer;
|
||||||
|
|
||||||
|
|
||||||
#endif // hifi_EntityItem_h
|
#endif // hifi_EntityItem_h
|
||||||
|
|
|
@ -106,8 +106,6 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class RenderArgs;
|
|
||||||
|
|
||||||
class Item {
|
class Item {
|
||||||
public:
|
public:
|
||||||
typedef std::vector<Item> Vector;
|
typedef std::vector<Item> Vector;
|
||||||
|
|
Loading…
Reference in a new issue