google-site-verification: googlebaca44933768a824.html Valve-style 3D Box Overlay - Old Royal Hack Forum

Announcement

Collapse
No announcement yet.

Valve-style 3D Box Overlay

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Valve-style 3D Box Overlay

    Code:
    void My_DrawIndexedQuad( Vector *verts, int id0, int id1, int id2, int id3 )
    {
    	CMeshBuilder meshBuilder;
    	IMesh *pMesh = g_pMaterialSystem->GetDynamicMesh();
    	meshBuilder.Begin( pMesh, MATERIAL_TRIANGLE_STRIP, 2 );
    
    	meshBuilder.Position3fv( verts[id0].Base() );
    	meshBuilder.AdvanceVertex();
    
    	meshBuilder.Position3fv( verts[id1].Base() );
    	meshBuilder.AdvanceVertex();
    
    	meshBuilder.Position3fv( verts[id3].Base() );
    	meshBuilder.AdvanceVertex();
    
    	meshBuilder.Position3fv( verts[id2].Base() );
    	meshBuilder.AdvanceVertex();
    
    	meshBuilder.End();
    	//////////////////////////////////////////////////////////////////////////
            // for 3D drawing in 2d draw
            CViewSetup myView;
            Frustum m_pFrustum;
            g_pClientFuncs->GetPlayerView(myView);                        //m_pClient
            g_pRender->Push3DView(myView,0,false,0,m_pFrustum);        //m_pRender
            //////////////////////////////////////////////////////////////////////////
            pMesh->Draw();
            //////////////////////////////////////////////////////////////////////////
            g_pRender->PopView(m_pFrustum);                        //m_pRender
            //////////////////////////////////////////////////////////////////////////
    
    }
    void My_Draw_AlphaBox( const Vector& origin, const Vector& mins, const Vector& maxs, const QAngle& angles, int r, int g, int b, int a )
    {
    	IMaterial *g_materialTranslucentSingleColor = g_pMaterialSystem->FindMaterial("debug/debugtranslucentsinglecolor",NULL,0,0);  
    	
    	// Build a rotation matrix from orientation
    	matrix3x4_t fRotateMatrix;
    	AngleMatrix( angles, fRotateMatrix );
    	
    	g_pMaterialSystem->Bind( g_materialTranslucentSingleColor );
    	g_materialTranslucentSingleColor->ColorModulate( r*(1.0f/255.0f), g*(1.0f/255.0f), b*(1.0f/255.0f) );
    	g_materialTranslucentSingleColor->AlphaModulate( a*(1.0f/255.0f) );
    	g_materialTranslucentSingleColor->SetMaterialVarFlag( MATERIAL_VAR_IGNOREZ, true );
    
    	Vector verts[8];
    
    	verts[0][0] = mins[0];
    	verts[0][1] = mins[1];
    	verts[0][2] = mins[2];
    	
    	verts[1][0] = maxs[0];
    	verts[1][1] = mins[1];
    	verts[1][2] = mins[2];
    	
    	verts[2][0] = maxs[0];
    	verts[2][1] = maxs[1];
    	verts[2][2] = mins[2];
    	
    	verts[3][0] = mins[0];
    	verts[3][1] = maxs[1];
    	verts[3][2] = mins[2];
    	
    	verts[4][0] = mins[0];
    	verts[4][1] = mins[1];
    	verts[4][2] = maxs[2];
    	
    	verts[5][0] = maxs[0];
    	verts[5][1] = mins[1];
    	verts[5][2] = maxs[2];
    	
    	verts[6][0] = maxs[0];
    	verts[6][1] = maxs[1];
    	verts[6][2] = maxs[2];
    	
    	verts[7][0] = mins[0];
    	verts[7][1] = maxs[1];
    	verts[7][2] = maxs[2];
    
    	// Transform the verts
    	Vector tverts[8];
    	for (int i=0;i<8;i++)
    	{
    		VectorRotate( verts[i], fRotateMatrix, tverts[i]);
    		VectorAdd(tverts[i],origin,tverts[i]);
    	}
    
    	My_DrawIndexedQuad( tverts, 0, 1, 2, 3 );
    	My_DrawIndexedQuad( tverts, 7, 6, 5, 4 );
    	My_DrawIndexedQuad( tverts, 1, 5, 6, 2 );
    	My_DrawIndexedQuad( tverts, 4, 0, 3, 7 );
    	My_DrawIndexedQuad( tverts, 3, 2, 6, 7 );
    	My_DrawIndexedQuad( tverts, 4, 5, 1, 0 );
    }
    Usage should be pretty obvious:
    Code:
    Vector vMin, vMax;
    pBaseEnt->GetRenderBounds( vMin, vMax );
    My_Draw_AlphaBox( pBaseEnt->GetAbsOrigin(), vMin, vMax, pBaseEnt->GetAbsAngles(), r, g, 0, 100 );
    Credits: Valve, Venoma

    Reason why this is better than using Debugoverlay:
    - Visibility through walls, you can set material yourself, you can set material flags yourself like:
    g_materialTranslucentSingleColor->SetMaterialVarFlag( MATERIAL_VAR_WIREFRAME, true );
    lolmaoman: Germans are born with a lifetime x22 login engraved into their birth certificates. True story.
    I DONT HAVE TEAMVIEWER AND IM NOT GOING TO GIVE ANY 24/7 ONLINE SUPPORT VIA STEAM, XFIRE OR OTHER IM PROGRAMS SO DONT BOTHER ASKING. THANKS.

    #2
    Gj There ;D

    I like walking wood boxes <3

    i search a good source code for Dods with aimbot and other stuff i know this is the same engine as counter strike source but css hacks are not work in dods.

    Comment


      #3
      css fails period

      but nice work i guess



      Originally posted by Tom
      Your days of trolling on this forum are now over. Troll one more person and its a permanent ban.

      Tom,

      Comment


        #4
        that look sexy mate gj






        gibs coins @
        1KatP9B8KG7mvcoFhdLGua1isG88nYZE8C

        Comment


          #5
          Gj mencore. now it's like drawing with OB Engine party008

          Comment


            #6
            thats very nice m3ncore, good work beavis

            Comment


              #7
              Thank you so much, this is amazing!

              OpenGL or DirectX or both?

              Thanks for my dumb question!
              swagg

              Comment


                #8
                Originally posted by darkbeam72 View Post
                Thank you so much, this is amazing!

                OpenGL or DirectX or both?

                Thanks for my dumb question!
                Well basically im using engine but in the end engine uses DirectX afterall so this is what it is.
                lolmaoman: Germans are born with a lifetime x22 login engraved into their birth certificates. True story.
                I DONT HAVE TEAMVIEWER AND IM NOT GOING TO GIVE ANY 24/7 ONLINE SUPPORT VIA STEAM, XFIRE OR OTHER IM PROGRAMS SO DONT BOTHER ASKING. THANKS.

                Comment


                  #9
                  well since screenshots are dead, thx imageshack;
                  there we go.
                  Attached Files






                  gibs coins @
                  1KatP9B8KG7mvcoFhdLGua1isG88nYZE8C

                  Comment

                  Working...
                  X