History

if switching to the mode where collision hulls are drawn, updateGeometry and simulate

Seth Alves committed 11 years ago

Commit eb78fa01 parent 997f7251 file · +29 −11Browse files

Showing the changes to libraries/render-utils/src/Model.cpp (1 of 1 file). Show all

Unified · Split

libraries/render-utils/src/Model.cpp+29−11
@@ -82,7 +82,8 @@ Model::Model(QObject* parent) : · 81 unmodified lines
8282 _appliedBlendNumber(0),
8383 _calculatedMeshBoxesValid(false),
8484 _calculatedMeshTrianglesValid(false),
85− _meshGroupsKnown(false) {
85+ _meshGroupsKnown(false),
86+ _renderCollisionHull(false) {
8687
8788 // we may have been created in the network thread, but we live in the main thread
8889 if (_viewState) {
@@ -712,13 +713,13 @@ bool Model::renderCore(float alpha, RenderMode mode, RenderArgs* args) { · 623 unmodified lines
712713 {
713714 GLenum buffers[3];
714715 int bufferCount = 0;
715− if (mode == DEFAULT_RENDER_MODE || mode == DIFFUSE_RENDER_MODE) {
716+ if (mode == DEFAULT_RENDER_MODE || mode == DIFFUSE_RENDER_MODE || mode == DEBUG_RENDER_MODE) {
716717 buffers[bufferCount++] = GL_COLOR_ATTACHMENT0;
717718 }
718− if (mode == DEFAULT_RENDER_MODE || mode == NORMAL_RENDER_MODE) {
719+ if (mode == DEFAULT_RENDER_MODE || mode == NORMAL_RENDER_MODE || mode == DEBUG_RENDER_MODE) {
719720 buffers[bufferCount++] = GL_COLOR_ATTACHMENT1;
720721 }
721− if (mode == DEFAULT_RENDER_MODE) {
722+ if (mode == DEFAULT_RENDER_MODE || mode == DEBUG_RENDER_MODE) {
722723 buffers[bufferCount++] = GL_COLOR_ATTACHMENT2;
723724 }
724725 GLBATCH(glDrawBuffers)(bufferCount, buffers);
@@ -777,7 +778,7 @@ bool Model::renderCore(float alpha, RenderMode mode, RenderArgs* args) { · 52 unmodified lines
777778 GLBATCH(glDrawBuffers)(bufferCount, buffers);
778779 }
779780
780− if (mode == DEFAULT_RENDER_MODE || mode == DIFFUSE_RENDER_MODE) {
781+ if (mode == DEFAULT_RENDER_MODE || mode == DIFFUSE_RENDER_MODE || mode == DEBUG_RENDER_MODE) {
781782 const float MOSTLY_TRANSPARENT_THRESHOLD = 0.0f;
782783 translucentMeshPartsRendered += renderMeshes(batch, mode, true, MOSTLY_TRANSPARENT_THRESHOLD, false, false, false, false, args, true);
783784 translucentMeshPartsRendered += renderMeshes(batch, mode, true, MOSTLY_TRANSPARENT_THRESHOLD, false, false, false, true, args, true);
@@ -1778,13 +1779,13 @@ void Model::endScene(RenderMode mode, RenderArgs* args) { · 994 unmodified lines
17781779 {
17791780 GLenum buffers[3];
17801781 int bufferCount = 0;
1781− if (mode == DEFAULT_RENDER_MODE || mode == DIFFUSE_RENDER_MODE) {
1782+ if (mode == DEFAULT_RENDER_MODE || mode == DIFFUSE_RENDER_MODE || mode == DEBUG_RENDER_MODE) {
17821783 buffers[bufferCount++] = GL_COLOR_ATTACHMENT0;
17831784 }
1784− if (mode == DEFAULT_RENDER_MODE || mode == NORMAL_RENDER_MODE) {
1785+ if (mode == DEFAULT_RENDER_MODE || mode == NORMAL_RENDER_MODE || mode == DEBUG_RENDER_MODE) {
17851786 buffers[bufferCount++] = GL_COLOR_ATTACHMENT1;
17861787 }
1787− if (mode == DEFAULT_RENDER_MODE) {
1788+ if (mode == DEFAULT_RENDER_MODE || mode == DEBUG_RENDER_MODE) {
17881789 buffers[bufferCount++] = GL_COLOR_ATTACHMENT2;
17891790 }
17901791 GLBATCH(glDrawBuffers)(bufferCount, buffers);
@@ -1843,7 +1844,7 @@ void Model::endScene(RenderMode mode, RenderArgs* args) { · 52 unmodified lines
18431844 GLBATCH(glDrawBuffers)(bufferCount, buffers);
18441845 }
18451846
1846− if (mode == DEFAULT_RENDER_MODE || mode == DIFFUSE_RENDER_MODE) {
1847+ if (mode == DEFAULT_RENDER_MODE || mode == DIFFUSE_RENDER_MODE || mode == DEBUG_RENDER_MODE) {
18471848 const float MOSTLY_TRANSPARENT_THRESHOLD = 0.0f;
18481849 translucentParts += renderMeshesForModelsInScene(batch, mode, true, MOSTLY_TRANSPARENT_THRESHOLD, false, false, false, false, args);
18491850 translucentParts += renderMeshesForModelsInScene(batch, mode, true, MOSTLY_TRANSPARENT_THRESHOLD, false, false, false, true, args);
@@ -1919,6 +1920,22 @@ bool Model::renderInScene(float alpha, RenderArgs* args) { · 69 unmodified lines
19191920 if (_meshStates.isEmpty()) {
19201921 return false;
19211922 }
1923+
1924+ if (args->_renderMode == RenderArgs::DEBUG_RENDER_MODE && _renderCollisionHull == false) {
1925+ qDebug() << "turning collision hull rendering on";
1926+ _renderCollisionHull = true;
1927+ _nextGeometry = _collisionGeometry;
1928+ _saveNonCollisionGeometry = _geometry;
1929+ updateGeometry();
1930+ simulate(0.0, true);
1931+ } else if (args->_renderMode != RenderArgs::DEBUG_RENDER_MODE && _renderCollisionHull == true) {
1932+ qDebug() << "turning collision hull rendering off";
1933+ _renderCollisionHull = false;
1934+ _nextGeometry = _saveNonCollisionGeometry;
1935+ updateGeometry();
1936+ simulate(0.0, true);
1937+ }
1938+
19221939 renderSetup(args);
19231940 _modelsInScene.push_back(this);
19241941 return true;
@@ -2402,8 +2419,9 @@ int Model::renderMeshes(gpu::Batch& batch, RenderMode mode, bool translucent, fl · 477 unmodified lines
24022419 }
24032420
24042421
2405−int Model::renderMeshesFromList(QVector<int>& list, gpu::Batch& batch, RenderMode mode, bool translucent, float alphaThreshold, RenderArgs* args,
2406− Locations* locations, SkinLocations* skinLocations, bool forceRenderMeshes) {
2422+int Model::renderMeshesFromList(QVector<int>& list, gpu::Batch& batch, RenderMode mode, bool translucent,
2423+ float alphaThreshold, RenderArgs* args, Locations* locations, SkinLocations* skinLocations,
2424+ bool forceRenderMeshes) {
24072425 PROFILE_RANGE(__FUNCTION__);
24082426
24092427 auto textureCache = DependencyManager::get<TextureCache>();

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t