REmoving comments

This commit is contained in:
samcake 2015-12-10 16:52:03 -08:00
parent dffb83a488
commit 20f3d6abe1
3 changed files with 14 additions and 28 deletions

View file

@ -277,16 +277,14 @@ namespace render {
using namespace render; using namespace render;
ModelMeshPartPayload::ModelMeshPartPayload(Model* model, int _meshIndex, int partIndex, int shapeIndex, ModelMeshPartPayload::ModelMeshPartPayload(Model* model, int _meshIndex, int partIndex, int shapeIndex, const Transform& transform, const Transform& offsetTransform) :
glm::vec3 position, glm::quat orientation) :
_model(model), _model(model),
_meshIndex(_meshIndex), _meshIndex(_meshIndex),
_shapeID(shapeIndex), _shapeID(shapeIndex) {
_modelPosition(position),
_modelOrientation(orientation) {
auto& modelMesh = _model->_geometry->getMeshes().at(_meshIndex)->_mesh; auto& modelMesh = _model->_geometry->getMeshes().at(_meshIndex)->_mesh;
updateMeshPart(modelMesh, partIndex); updateMeshPart(modelMesh, partIndex);
updateTransform(transform, offsetTransform);
initCache(); initCache();
} }
@ -314,11 +312,6 @@ void ModelMeshPartPayload::notifyLocationChanged() {
_model->_needsUpdateClusterMatrices = true; _model->_needsUpdateClusterMatrices = true;
} }
void ModelMeshPartPayload::updateModelLocation(glm::vec3 position, glm::quat orientation) {
_modelPosition = position;
_modelOrientation = orientation;
}
render::ItemKey ModelMeshPartPayload::getKey() const { render::ItemKey ModelMeshPartPayload::getKey() const {
ItemKey::Builder builder; ItemKey::Builder builder;
builder.withTypeShape(); builder.withTypeShape();

View file

@ -73,30 +73,27 @@ namespace render {
class ModelMeshPartPayload : public MeshPartPayload { class ModelMeshPartPayload : public MeshPartPayload {
public: public:
ModelMeshPartPayload(Model* model, int meshIndex, int partIndex, int shapeIndex, glm::vec3 position, glm::quat orientation); ModelMeshPartPayload(Model* model, int meshIndex, int partIndex, int shapeIndex, const Transform& transform, const Transform& offsetTransform);
typedef render::Payload<ModelMeshPartPayload> Payload; typedef render::Payload<ModelMeshPartPayload> Payload;
typedef Payload::DataPointer Pointer; typedef Payload::DataPointer Pointer;
virtual void notifyLocationChanged(); void notifyLocationChanged() override;
virtual void updateModelLocation(glm::vec3 position, glm::quat orientation);
// Render Item interface // Render Item interface
render::ItemKey getKey() const; render::ItemKey getKey() const override;
render::Item::Bound getBound() const; render::Item::Bound getBound() const override;
void render(RenderArgs* args) const; void render(RenderArgs* args) const override;
// ModelMeshPartPayload functions to perform render // ModelMeshPartPayload functions to perform render
void bindMesh(gpu::Batch& batch) const; void bindMesh(gpu::Batch& batch) const override;
void bindTransform(gpu::Batch& batch, const ModelRender::Locations* locations) const; void bindTransform(gpu::Batch& batch, const ModelRender::Locations* locations) const override;
void initCache(); void initCache();
Model* _model; Model* _model;
int _meshIndex; int _meshIndex;
int _shapeID; int _shapeID;
glm::vec3 _modelPosition;
glm::quat _modelOrientation;
bool _isSkinned = false; bool _isSkinned = false;
bool _isBlendShaped = false; bool _isBlendShaped = false;
}; };

View file

@ -503,9 +503,7 @@ bool Model::addToScene(std::shared_ptr<render::Scene> scene, render::PendingChan
foreach (auto renderItem, _renderItemsSet) { foreach (auto renderItem, _renderItemsSet) {
auto item = scene->allocateID(); auto item = scene->allocateID();
// auto renderData = MeshPartPayload::Pointer(renderItem); auto renderPayload = std::make_shared<MeshPartPayload::Payload>(renderItem);
auto renderData = renderItem;
auto renderPayload = std::make_shared<MeshPartPayload::Payload>(renderData);
pendingChanges.resetItem(item, renderPayload); pendingChanges.resetItem(item, renderPayload);
pendingChanges.updateItem<MeshPartPayload>(item, [&](MeshPartPayload& data) { pendingChanges.updateItem<MeshPartPayload>(item, [&](MeshPartPayload& data) {
data.notifyLocationChanged(); data.notifyLocationChanged();
@ -532,8 +530,7 @@ bool Model::addToScene(std::shared_ptr<render::Scene> scene,
foreach (auto renderItem, _renderItemsSet) { foreach (auto renderItem, _renderItemsSet) {
auto item = scene->allocateID(); auto item = scene->allocateID();
auto renderData = MeshPartPayload::Pointer(renderItem); auto renderPayload = std::make_shared<MeshPartPayload::Payload>(renderItem);
auto renderPayload = std::make_shared<MeshPartPayload::Payload>(renderData);
renderPayload->addStatusGetters(statusGetters); renderPayload->addStatusGetters(statusGetters);
pendingChanges.resetItem(item, renderPayload); pendingChanges.resetItem(item, renderPayload);
pendingChanges.updateItem<MeshPartPayload>(item, [&](MeshPartPayload& data) { pendingChanges.updateItem<MeshPartPayload>(item, [&](MeshPartPayload& data) {
@ -1185,7 +1182,7 @@ void Model::segregateMeshGroups() {
_renderItemsSet << std::make_shared<MeshPartPayload>(networkMesh._mesh, partIndex, ModelRender::getCollisionHullMaterial(), transform, offset); _renderItemsSet << std::make_shared<MeshPartPayload>(networkMesh._mesh, partIndex, ModelRender::getCollisionHullMaterial(), transform, offset);
} else { } else {
_renderItemsSet << std::make_shared<ModelMeshPartPayload>(this, i, partIndex, shapeID, _translation, _rotation); _renderItemsSet << std::make_shared<ModelMeshPartPayload>(this, i, partIndex, shapeID, transform, offset);
} }
shapeID++; shapeID++;
@ -1210,8 +1207,7 @@ bool Model::initWhenReady(render::ScenePointer scene) {
foreach (auto renderItem, _renderItemsSet) { foreach (auto renderItem, _renderItemsSet) {
auto item = scene->allocateID(); auto item = scene->allocateID();
auto renderData = MeshPartPayload::Pointer(renderItem); auto renderPayload = std::make_shared<MeshPartPayload::Payload>(renderItem);
auto renderPayload = std::make_shared<MeshPartPayload::Payload>(renderData);
_renderItems.insert(item, renderPayload); _renderItems.insert(item, renderPayload);
pendingChanges.resetItem(item, renderPayload); pendingChanges.resetItem(item, renderPayload);
pendingChanges.updateItem<MeshPartPayload>(item, [&](MeshPartPayload& data) { pendingChanges.updateItem<MeshPartPayload>(item, [&](MeshPartPayload& data) {