History

Unify Named/Normal calls

Atlante45 committed 10 years ago

Commit ccb183e1 parent 9e0af6310 files · +20 −85Browse files

Showing the changes to libraries/render-utils/src/GeometryCache.cpp (1 of 10 files). Show all

Unified · Split

libraries/render-utils/src/GeometryCache.cpp+3−11
@@ -43,7 +43,6 @@ static const int VERTICES_PER_TRIANGLE = 3; · 42 unmodified lines
4343 static const gpu::Element POSITION_ELEMENT{ gpu::VEC3, gpu::FLOAT, gpu::XYZ };
4444 static const gpu::Element NORMAL_ELEMENT{ gpu::VEC3, gpu::FLOAT, gpu::XYZ };
4545 static const gpu::Element COLOR_ELEMENT{ gpu::VEC4, gpu::NUINT8, gpu::RGBA };
46−static const gpu::Element TRANSFORM_ELEMENT{ gpu::MAT4, gpu::FLOAT, gpu::XYZW };
4746
4847 static gpu::Stream::FormatPointer SOLID_STREAM_FORMAT;
4948 static gpu::Stream::FormatPointer INSTANCED_SOLID_STREAM_FORMAT;
@@ -491,7 +490,6 @@ gpu::Stream::FormatPointer& getInstancedSolidStreamFormat() { · 441 unmodified lines
491490 INSTANCED_SOLID_STREAM_FORMAT->setAttribute(gpu::Stream::POSITION, gpu::Stream::POSITION, POSITION_ELEMENT);
492491 INSTANCED_SOLID_STREAM_FORMAT->setAttribute(gpu::Stream::NORMAL, gpu::Stream::NORMAL, NORMAL_ELEMENT);
493492 INSTANCED_SOLID_STREAM_FORMAT->setAttribute(gpu::Stream::COLOR, gpu::Stream::COLOR, COLOR_ELEMENT, 0, gpu::Stream::PER_INSTANCE);
494− INSTANCED_SOLID_STREAM_FORMAT->setAttribute(gpu::Stream::INSTANCE_XFM, gpu::Stream::INSTANCE_XFM, TRANSFORM_ELEMENT, 0, gpu::Stream::PER_INSTANCE);
495493 }
496494 return INSTANCED_SOLID_STREAM_FORMAT;
497495 }
@@ -511,11 +509,9 @@ GeometryCache::~GeometryCache() { · 13 unmodified lines
511509 #endif //def WANT_DEBUG
512510 }
513511
514−void setupBatchInstance(gpu::Batch& batch, gpu::BufferPointer transformBuffer, gpu::BufferPointer colorBuffer) {
512+void setupBatchInstance(gpu::Batch& batch, gpu::BufferPointer colorBuffer) {
515513 gpu::BufferView colorView(colorBuffer, COLOR_ELEMENT);
516514 batch.setInputBuffer(gpu::Stream::COLOR, colorView);
517− gpu::BufferView instanceXfmView(transformBuffer, 0, transformBuffer->getSize(), TRANSFORM_ELEMENT);
518− batch.setInputBuffer(gpu::Stream::INSTANCE_XFM, instanceXfmView);
519515 }
520516
521517 void GeometryCache::renderShape(gpu::Batch& batch, Shape shape) {
@@ -530,13 +526,13 @@ void GeometryCache::renderWireShape(gpu::Batch& batch, Shape shape) { · 8 unmodified lines
530526
531527 void GeometryCache::renderShapeInstances(gpu::Batch& batch, Shape shape, size_t count, gpu::BufferPointer& transformBuffer, gpu::BufferPointer& colorBuffer) {
532528 batch.setInputFormat(getInstancedSolidStreamFormat());
533− setupBatchInstance(batch, transformBuffer, colorBuffer);
529+ setupBatchInstance(batch, colorBuffer);
534530 _shapes[shape].drawInstances(batch, count);
535531 }
536532
537533 void GeometryCache::renderWireShapeInstances(gpu::Batch& batch, Shape shape, size_t count, gpu::BufferPointer& transformBuffer, gpu::BufferPointer& colorBuffer) {
538534 batch.setInputFormat(getInstancedSolidStreamFormat());
539− setupBatchInstance(batch, transformBuffer, colorBuffer);
535+ setupBatchInstance(batch, colorBuffer);
540536 _shapes[shape].drawWireInstances(batch, count);
541537 }
542538
@@ -1871,11 +1867,7 @@ void renderInstances(const std::string& name, gpu::Batch& batch, const Transform · 1328 unmodified lines
18711867
18721868 batch.setupNamedCalls(name, [f](gpu::Batch& batch, gpu::Batch::NamedBatchData& data) {
18731869 auto pipeline = DependencyManager::get<GeometryCache>()->bindSimpleProgram(batch);
1874− auto location = pipeline->getProgram()->getUniforms().findLocation("Instanced");
1875−
1876− batch._glUniform1i(location, 1);
18771870 f(batch, data);
1878− batch._glUniform1i(location, 0);
18791871 });
18801872 }
18811873