Using DrawPoly()



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 13/10/2009 at 15:53, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   11 
    Platform:   Windows  ;   
    Language(s) :     C++  ;

    ---------
    Hello I am currently using Polygon3D to create a visual aid in my plugin. I was wondering if someone could tell me how I would use DrawPoly to accomplish the same task?

    Here is the code I use that uses Polygon3D()

    Here's the declarations and such.

    > `

      
    \>      BaseContainer *bc=((BaseList2D* )tag)->GetDataInstance();  
    \>      LONG lngMySymPlane =tag->GetDataInstance()->GetLong (SYMMETRY_PLANE);  
    \>       LONG lngMirroredSide = tag->GetDataInstance()->GetLong(MIRRORED_SIDE);  
    \>      LONG trans = 100;  
    \>       LONG boxTrans     = 200;  
    \>      Vector color = bc->GetVector(PLANE_COLOR);  
    \>       Vector boxColor = bc->GetVector(BOX_COLOR);  
    \>       Real size;  
    \>       size = .60;  
    \>         
    \>      //Matrix for determining scale, rotation, and position.   
    \>       Matrix m = op->GetMg();  
    \>      Vector rad = op->GetRad();  
    \>    
    \>      m.v1 *= rad.x+rad.x;  
    \>      m.v2 *= rad.y+rad.y;  
    \>      m.v3 *= rad.z+rad.z;  
    \>    
    \>  
    

    `

    Here is one of the times that Polygon3D is called.

    > `

      
    \>    
    \>              if (tag->GetDataInstance()->GetBool(SHOW_PLANE)) // If SHOW_PLANE is checked, then draw the polygon.  
    \>              {  
    \>                   
    \>                      Vector p[4];  
    \>    
    \>                      p[0] = Vector(-1,1,0);  
    \>                      p[1] = Vector(1,1,0);  
    \>                      p[2] = Vector(1,-1,0);  
    \>                      p[3] = Vector(-1,-1,0);  
    \>                        
    \>                        
    \>                      p[0] = p[0] * m;  
    \>                      p[1] = p[1] * m;  
    \>                      p[2] = p[2] * m;  
    \>                      p[3] = p[3] * m;  
    \>    
    \>                      Vector f[3] = { Vector(color),Vector(color),Vector(color)};  
    \>    
    \>                      bd->SetLightList(BDRAW_SETLIGHTLIST_NOLIGHTS);  
    \>                      bd->SetTransparency(trans);  
    \>                      bd->Polygon3D(p,f,TRUE);  
    \>                        
    \>    
    \>    
    \>                      return true;  
    \>              }  
    \>    
    \>    
    \>  
    

    `

    I would like to try to use DrawPoly fo this because the results I get from Polygon3D are not quite as good as I had hoped.. There are a lot of shading issues.

    Any help would be greatly appreciated.

    Thanks,

    ~Shawn



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 14/10/2009 at 03:19, xxxxxxxx wrote:

    Anyone know how I would accomplish this with DrawPoly()?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 14/10/2009 at 04:01, xxxxxxxx wrote:

    Here is a simple example how to draw for instance a shaded triangle.

    > \> Bool LookAtCamera::Draw(PluginTag \*tag, BaseObject \*op, BaseDraw \*bd, BaseDrawHelp \*bh) \> { \>      //use scene lights for shading \>      bd->SetLightList(BDRAW_SETLIGHTLIST_SCENELIGHTS); \> \>      //set the drawing space; in this case it's the object space of the tag's parent object \>      bd->SetMatrix_Matrix(NULL, op->GetMg(), 0); \> \>      //create arrays for the vertex postions, colors and normals \>      Vector vp[3] = { Vector(0.0), Vector(0.0,100.0,0.0), Vector(100.0,0.0,0.0) }; \>      Vector vf[3] = { Vector(1.0), Vector(1.0), Vector(1.0) }; \>      Vector vn[3] = { Vector(0.0,0.0,-1.0), Vector(0.0,0.0,-1.0), Vector(0.0,0.0,-1.0) }; \> \>      bd->DrawPoly(vp, vf, vn, 3, 0); \> \>      return TRUE; \> } \>

    cheers,
    Matthias



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 14/10/2009 at 06:41, xxxxxxxx wrote:

    Thanks Matthias, That helps immensely.

    ~Shawn


Log in to reply