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
82 _appliedBlendNumber(0),82 _appliedBlendNumber(0),
83 _calculatedMeshBoxesValid(false),83 _calculatedMeshBoxesValid(false),
84 _calculatedMeshTrianglesValid(false),84 _calculatedMeshTrianglesValid(false),
85 _meshGroupsKnown(false) {85 _meshGroupsKnown(false),
86 _renderCollisionHull(false) {
86 87
87 // we may have been created in the network thread, but we live in the main thread88 // we may have been created in the network thread, but we live in the main thread
88 if (_viewState) {89 if (_viewState) {
@@ -712,13 +713,13 @@ bool Model::renderCore(float alpha, RenderMode mode, RenderArgs* args) { · 623 unmodified lines
712 {713 {
713 GLenum buffers[3];714 GLenum buffers[3];
714 int bufferCount = 0;715 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) {
716 buffers[bufferCount++] = GL_COLOR_ATTACHMENT0;717 buffers[bufferCount++] = GL_COLOR_ATTACHMENT0;
717 }718 }
718 if (mode == DEFAULT_RENDER_MODE || mode == NORMAL_RENDER_MODE) {719 if (mode == DEFAULT_RENDER_MODE || mode == NORMAL_RENDER_MODE || mode == DEBUG_RENDER_MODE) {
719 buffers[bufferCount++] = GL_COLOR_ATTACHMENT1;720 buffers[bufferCount++] = GL_COLOR_ATTACHMENT1;
720 }721 }
721 if (mode == DEFAULT_RENDER_MODE) {722 if (mode == DEFAULT_RENDER_MODE || mode == DEBUG_RENDER_MODE) {
722 buffers[bufferCount++] = GL_COLOR_ATTACHMENT2;723 buffers[bufferCount++] = GL_COLOR_ATTACHMENT2;
723 }724 }
724 GLBATCH(glDrawBuffers)(bufferCount, buffers);725 GLBATCH(glDrawBuffers)(bufferCount, buffers);
@@ -777,7 +778,7 @@ bool Model::renderCore(float alpha, RenderMode mode, RenderArgs* args) { · 52 unmodified lines
777 GLBATCH(glDrawBuffers)(bufferCount, buffers);778 GLBATCH(glDrawBuffers)(bufferCount, buffers);
778 }779 }
779 780
780 if (mode == DEFAULT_RENDER_MODE || mode == DIFFUSE_RENDER_MODE) {781 if (mode == DEFAULT_RENDER_MODE || mode == DIFFUSE_RENDER_MODE || mode == DEBUG_RENDER_MODE) {
781 const float MOSTLY_TRANSPARENT_THRESHOLD = 0.0f;782 const float MOSTLY_TRANSPARENT_THRESHOLD = 0.0f;
782 translucentMeshPartsRendered += renderMeshes(batch, mode, true, MOSTLY_TRANSPARENT_THRESHOLD, false, false, false, false, args, true);783 translucentMeshPartsRendered += renderMeshes(batch, mode, true, MOSTLY_TRANSPARENT_THRESHOLD, false, false, false, false, args, true);
783 translucentMeshPartsRendered += renderMeshes(batch, mode, true, MOSTLY_TRANSPARENT_THRESHOLD, false, false, false, true, args, true);784 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
1778 {1779 {
1779 GLenum buffers[3];1780 GLenum buffers[3];
1780 int bufferCount = 0;1781 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) {
1782 buffers[bufferCount++] = GL_COLOR_ATTACHMENT0;1783 buffers[bufferCount++] = GL_COLOR_ATTACHMENT0;
1783 }1784 }
1784 if (mode == DEFAULT_RENDER_MODE || mode == NORMAL_RENDER_MODE) {1785 if (mode == DEFAULT_RENDER_MODE || mode == NORMAL_RENDER_MODE || mode == DEBUG_RENDER_MODE) {
1785 buffers[bufferCount++] = GL_COLOR_ATTACHMENT1;1786 buffers[bufferCount++] = GL_COLOR_ATTACHMENT1;
1786 }1787 }
1787 if (mode == DEFAULT_RENDER_MODE) {1788 if (mode == DEFAULT_RENDER_MODE || mode == DEBUG_RENDER_MODE) {
1788 buffers[bufferCount++] = GL_COLOR_ATTACHMENT2;1789 buffers[bufferCount++] = GL_COLOR_ATTACHMENT2;
1789 }1790 }
1790 GLBATCH(glDrawBuffers)(bufferCount, buffers);1791 GLBATCH(glDrawBuffers)(bufferCount, buffers);
@@ -1843,7 +1844,7 @@ void Model::endScene(RenderMode mode, RenderArgs* args) { · 52 unmodified lines
1843 GLBATCH(glDrawBuffers)(bufferCount, buffers);1844 GLBATCH(glDrawBuffers)(bufferCount, buffers);
1844 }1845 }
1845 1846
1846 if (mode == DEFAULT_RENDER_MODE || mode == DIFFUSE_RENDER_MODE) {1847 if (mode == DEFAULT_RENDER_MODE || mode == DIFFUSE_RENDER_MODE || mode == DEBUG_RENDER_MODE) {
1847 const float MOSTLY_TRANSPARENT_THRESHOLD = 0.0f;1848 const float MOSTLY_TRANSPARENT_THRESHOLD = 0.0f;
1848 translucentParts += renderMeshesForModelsInScene(batch, mode, true, MOSTLY_TRANSPARENT_THRESHOLD, false, false, false, false, args);1849 translucentParts += renderMeshesForModelsInScene(batch, mode, true, MOSTLY_TRANSPARENT_THRESHOLD, false, false, false, false, args);
1849 translucentParts += renderMeshesForModelsInScene(batch, mode, true, MOSTLY_TRANSPARENT_THRESHOLD, false, false, false, true, args);1850 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
1919 if (_meshStates.isEmpty()) {1920 if (_meshStates.isEmpty()) {
1920 return false;1921 return false;
1921 }1922 }
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
1922 renderSetup(args);1939 renderSetup(args);
1923 _modelsInScene.push_back(this);1940 _modelsInScene.push_back(this);
1924 return true;1941 return true;
@@ -2402,8 +2419,9 @@ int Model::renderMeshes(gpu::Batch& batch, RenderMode mode, bool translucent, fl · 477 unmodified lines
2402}2419}
2403 2420
2404 2421
2405int Model::renderMeshesFromList(QVector<int>& list, gpu::Batch& batch, RenderMode mode, bool translucent, float alphaThreshold, RenderArgs* args,2422int Model::renderMeshesFromList(QVector<int>& list, gpu::Batch& batch, RenderMode mode, bool translucent,
2406 Locations* locations, SkinLocations* skinLocations, bool forceRenderMeshes) {2423 float alphaThreshold, RenderArgs* args, Locations* locations, SkinLocations* skinLocations,
2424 bool forceRenderMeshes) {
2407 PROFILE_RANGE(__FUNCTION__);2425 PROFILE_RANGE(__FUNCTION__);
2408 2426
2409 auto textureCache = DependencyManager::get<TextureCache>();2427 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