davep avatar davep committed 08b3bba

SH-1778 Physics shape display fix up.

Comments (0)

Files changed (4)

indra/llprimitive/llmodel.cpp

 
 	if (decomp.has("BoundingVerts"))
 	{
-		const LLSD::Binary& position = decomp["BundingVerts"].asBinary();
+		const LLSD::Binary& position = decomp["BoundingVerts"].asBinary();
 
 		U16* p = (U16*) &position[0];
 
 	{
 		//empty base hull mesh to indicate decomposition has been loaded
 		//but contains no base hull
-		mBaseHullMesh.clear();;
+		mBaseHullMesh.clear();
 	}
 }
 
 		ret["Positions"] = p;
 	}
 
+	llassert(!mBaseHull.empty());
+
 	if (!mBaseHull.empty())
 	{
 		LLSD::Binary p(mBaseHull.size()*3*2);

indra/llrender/llrendertarget.cpp

 void LLRenderTarget::allocate(U32 resx, U32 resy, U32 color_fmt, bool depth, bool stencil, LLTexUnit::eTextureType usage, bool use_fbo, S32 samples)
 {
 	stop_glerror();
+	
+	release();
+
 	mResX = resx;
 	mResY = resy;
 
 		mSamples = 0;
 	}
 
-	release();
-
 	if ((sUseFBO || use_fbo) && gGLManager.mHasFramebufferObject)
 	{
 		if (depth)
 		LLImageGL::deleteTextures(mTex.size(), &mTex[0], true);
 		mTex.clear();
 	}
+	
+	mResX = mResY = 0;
 
 	sBoundTarget = NULL;
 }

indra/newview/llspatialpartition.cpp

 
 void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)
 {
-	if (volume->isSelected())
-	{
-		LLVector3 construct_me(5,5,5);
-		construct_me.normalize();
-	}
-
-	
 	U8 physics_type = volume->getPhysicsShapeType();
 
 	if (physics_type == LLViewerObject::PHYSICS_SHAPE_NONE || volume->isFlexible())

indra/newview/pipeline.cpp

 //static
 void LLPipeline::refreshRenderDeferred()
 {
-	static BOOL physics_shapes_is_on = FALSE ;
-	static BOOL render_glow_copy = FALSE ;
-
-	if(gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_PHYSICS_SHAPES))
-	{
-		if(!physics_shapes_is_on)
-		{
-			physics_shapes_is_on = TRUE ;
-			render_glow_copy = sRenderGlow ;
-		}
-
-		//turn the deferred rendering and glow off when draw physics shapes.
-		sRenderDeferred = FALSE ;
-		sRenderGlow = FALSE ;
-	}
-	else
-	{
-		if(physics_shapes_is_on)
-		{
-			physics_shapes_is_on = FALSE ;
-			sRenderGlow = render_glow_copy ;
-		}
-
-		updateRenderDeferred() ;
-	}
+	updateRenderDeferred();
 }
 
 void LLPipeline::releaseGLBuffers()
 {
 	LLMemType mt_ru(LLMemType::MTYPE_PIPELINE_RENDER_BLOOM);
 	if (!(gPipeline.canUseVertexShaders() &&
-		sRenderGlow))
+		sRenderGlow) ||
+		(!sRenderDeferred && hasRenderDebugMask(LLPipeline::RENDER_DEBUG_PHYSICS_SHAPES)))
 	{
 		return;
 	}
 
 	gGL.setColorMask(true, true);
 	glClearColor(0,0,0,0);
-
-	/*if (for_snapshot)
-	{
-		gGL.getTexUnit(0)->bind(&mGlow[1]);
-		{
-			//LLGLEnable stencil(GL_STENCIL_TEST);
-			//glStencilFunc(GL_NOTEQUAL, 255, 0xFFFFFFFF);
-			//glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
-			//LLGLDisable blend(GL_BLEND);
-
-			// If the snapshot is constructed from tiles, calculate which
-			// tile we're in.
-
-			//from LLViewerCamera::setPerpsective
-			if (zoom_factor > 1.f)
-			{
-				int pos_y = subfield / llceil(zoom_factor);
-				int pos_x = subfield - (pos_y*llceil(zoom_factor));
-				F32 size = 1.f/zoom_factor;
-
-				tc1.set(pos_x*size, pos_y*size);
-				tc2 = tc1 + LLVector2(size,size);
-			}
-			else
-			{
-				tc2.set(1,1);
-			}
-			
-			LLGLEnable blend(GL_BLEND);
-			gGL.setSceneBlendType(LLRender::BT_ADD);
-			
-				
-			gGL.begin(LLRender::TRIANGLE_STRIP);
-			gGL.color4f(1,1,1,1);
-			gGL.texCoord2f(tc1.mV[0], tc1.mV[1]);
-			gGL.vertex2f(-1,-1);
-			
-			gGL.texCoord2f(tc1.mV[0], tc2.mV[1]);
-			gGL.vertex2f(-1,1);
-			
-			gGL.texCoord2f(tc2.mV[0], tc1.mV[1]);
-			gGL.vertex2f(1,-1);
-			
-			gGL.texCoord2f(tc2.mV[0], tc2.mV[1]);
-			gGL.vertex2f(1,1);
-
-			gGL.end();
-
-			gGL.flush();
-			gGL.setSceneBlendType(LLRender::BT_ALPHA);
-		}
-
-		gGL.flush();
-		glMatrixMode(GL_PROJECTION);
-		glPopMatrix();
-		glMatrixMode(GL_MODELVIEW);
-		glPopMatrix();
-
-		return;
-	}*/
-	
+		
 	{
 		{
 			LLFastTimer ftm(FTM_RENDER_BLOOM_FBO);
 
 	if (hasRenderDebugMask(LLPipeline::RENDER_DEBUG_PHYSICS_SHAPES))
 	{
+		gGL.setColorMask(true, false);
+
 		LLVector2 tc1(0,0);
 		LLVector2 tc2((F32) gViewerWindow->getWorldViewWidthRaw()*2,
 				  (F32) gViewerWindow->getWorldViewHeightRaw()*2);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.