Thread: 3D Boxes

Results 1 to 5 of 5
  1. #1
    supercarz1991's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Posts
    6,285
    Reputation
    435
    Thanks
    3,715
    My Mood
    Doh

    3D Boxes

    Code:
    void CEngine::Draw3DBoundingBox( LTVector mins, LTVector maxs, D3DCOLOR color ) 
    { 
        if( !m_pDevice ) 
            return; 
    
        const unsigned short index[] = {0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 3, 7, 2, 6, 0, 4, 1, 5}; 
    
        struct VertexData 
        { 
            float x, y, z; 
            D3DCOLOR color; 
            float tu, tv; 
        }; 
    
        VertexData ObjectBounds[8]; 
    
    #define SET_OBJECT_BOUNDS_VEC_VALUE( i, o, t, w, c ) \ 
        ObjectBounds[i].x = o; ObjectBounds[i].y = t; ObjectBounds[i].z = w; \ 
        ObjectBounds[i].color = c; ObjectBounds[i].tu = 0.0f; ObjectBounds[i].tv = 0.0f; 
    
        SET_OBJECT_BOUNDS_VEC_VALUE( 0, mins.x, mins.y, mins.z, color ); 
        SET_OBJECT_BOUNDS_VEC_VALUE( 1, maxs.x, mins.y, mins.z, color ); 
        SET_OBJECT_BOUNDS_VEC_VALUE( 2, maxs.x, mins.y, maxs.z, color ); 
        SET_OBJECT_BOUNDS_VEC_VALUE( 3, mins.x, mins.y, maxs.z, color ); 
        SET_OBJECT_BOUNDS_VEC_VALUE( 4, mins.x, maxs.y, mins.z, color ); 
        SET_OBJECT_BOUNDS_VEC_VALUE( 5, maxs.x, maxs.y, mins.z, color ); 
        SET_OBJECT_BOUNDS_VEC_VALUE( 6, maxs.x, maxs.y, maxs.z, color ); 
        SET_OBJECT_BOUNDS_VEC_VALUE( 7, mins.x, maxs.y, maxs.z, color ); 
    
        m_pDevice->SetFVF( D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1 ); 
        m_pDevice->DrawIndexedPrimitiveUP( D3DPT_LINELIST, 0, 24, 12, (void *)index, D3DFMT_INDEX16, ObjectBounds, sizeof( VertexData ) ); 
    } 
    
    void CEngine::Draw3DBoundingBoxChams( LTVector mins, LTVector maxs, D3DCOLOR color1, D3DCOLOR color2 ) 
    { 
        m_pDevice->SetRenderState( D3DRS_ZENABLE, FALSE ); 
        m_pDevice->SetRenderState( D3DRS_ZFUNC, D3DCMP_NEVER ); 
    
        Draw3DBoundingBox( mins, maxs, color1 ); 
    
        m_pDevice->SetRenderState( D3DRS_ZENABLE, TRUE ); 
        m_pDevice->SetRenderState( D3DRS_ZFUNC, D3DCMP_LESSEQUAL ); 
    
        Draw3DBoundingBox( mins, maxs, color2 ); 
    }
    This is from a CS:S D3D Base BUT it also works on CA

    idk who to credit, it randomly popped up in 1 of my many many d3d9 bases on my computer
    Last edited by supercarz1991; 04-23-2012 at 11:23 PM.

    commando: You're probably the best non-coder coder I know LOL


  2. The Following User Says Thank You to supercarz1991 For This Useful Post:

    pDevice (04-24-2012)

  3. #2
    pDevice's Avatar
    Join Date
    Feb 2012
    Gender
    male
    Location
    d3d9.h
    Posts
    1,306
    Reputation
    15
    Thanks
    420
    My Mood
    Stressed
    thanks very good



  4. #3
    TokolocoSK's Avatar
    Join Date
    Feb 2011
    Gender
    male
    Location
    Comendo Peru Pato Frango Búrguer.
    Posts
    2,874
    Reputation
    65
    Thanks
    6,858
    My Mood
    Yeehaw
    Credits for s0beit ...



  5. #4
    supercarz1991's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Posts
    6,285
    Reputation
    435
    Thanks
    3,715
    My Mood
    Doh
    Quote Originally Posted by TokolocoSK View Post
    Credits for s0beit ...
    the base is from July 2010... so if he made it before that, then the credits are to him

    commando: You're probably the best non-coder coder I know LOL


  6. #5
    wicho_koz's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Posts
    193
    Reputation
    12
    Thanks
    52
    My Mood
    Shocked
    Good Job anyways
    |^^^^^^^^^^\||____
    |The[MPGH]Truck |||'""|""\__,_
    | _____ 4ever __ l||__|__|___|)
    |(@)@)"""""""**|(@)(@)**|(@)


Similar Threads

  1. [Help] Rotating 3D Box
    By topblast in forum Combat Arms Coding Help & Discussion
    Replies: 3
    Last Post: 12-25-2010, 11:12 PM
  2. blackpkerstr emty you mail box, I cant send anything to you
    By radnomguywfq3 in forum Spammers Corner
    Replies: 1
    Last Post: 02-25-2007, 11:51 AM
  3. Ammo/Damage Box Values?
    By wooden_amulet in forum WarRock - International Hacks
    Replies: 4
    Last Post: 06-02-2006, 02:55 AM
  4. Sig Rotator
    By blahblahz in forum Tutorials
    Replies: 5
    Last Post: 05-15-2006, 03:02 AM
  5. Advanced Box Cut
    By Chronologix in forum Tutorials
    Replies: 11
    Last Post: 01-23-2006, 09:00 PM