Use DrawPointArray to draw shaded points

On 09/12/2015 at 13:18, xxxxxxxx wrote:

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

---------
Hi there,

I'm trying to use BaseDraw::DrawPointArray() to draw shaded points. According to the documentation (https://developers.maxon.net/docs/Cinema4DCPPSDK/html/class_base_draw.html#affe6235c549a43787a1cb5ae5d654d3d) this should be possible by using the aforementioned function. My code looks something like this:

bd->SetLightList(BDRAW_SETLIGHTLIST_SCENELIGHTS);
bd->SetPointSize(3.0f);
bd->SetMatrix_Matrix(op, bd.GetMg());
bd->DrawPointArray(nPnts, pos, col, 3, norm);

It draws points of the right size in the right position, but no shading is being done (yes, the normals have valid values and are normalized). Does anybody know what I'm doing wrong?

Best
Timm

On 11/12/2015 at 07:46, xxxxxxxx wrote:

Hello,

it seems that DrawPointArray() does not shade the points. We forwarded the question to the developer to get more information.

Best wishes,
Sebastian

On 11/12/2015 at 09:43, xxxxxxxx wrote:

It works fine for me in R13.
Add this code to the SDK AtomObject example and see if it works in your version.

class AtomObject : public ObjectData  
{  
  public:  
      DRAWRESULT  Draw(BaseObject *op, DRAWPASS drawpass, BaseDraw *bd, BaseDrawHelp *bh);  
      virtual     Bool Init(GeListNode *node);  
      virtual     BaseObject* GetVirtualObjects(BaseObject *op, HierarchyHelp *hh);  
      virtual     Bool Message(GeListNode *node, LONG type, void *t_data);  
  
      static      NodeData *Alloc(void) { return gNew AtomObject; }  
};  
  
  
DRAWRESULT AtomObject::Draw(BaseObject *op, DRAWPASS drawpass, BaseDraw *bd, BaseDrawHelp *bh)  
{  
  bd->SetMatrix_Screen();  
  bd->SetPointSize(5.5);  
  
  LONG count = 3;  
  SVector pointpos[3] = { SVector(500, 200, 0), SVector(510, 200, 0), SVector(520, 200, 0) }; //Create the array with the point positions  
  SVector normals[3] = { SVector(1, 0, 0), SVector(1, 0, 0), SVector(1, 0, 0) };              //The normals directions  
  SReal pointcolors[9] = { 1, 0, 0, 0, 1, 0, 0, 0, 0 };                                       //Each point needs 3 color values(RGB)  
  bd->DrawPointArray(count, pointpos, pointcolors, 3, normals);                               //Draws the points on the screen  
  
  return DRAWRESULT_OK;  
}

-ScottA

On 15/12/2015 at 05:49, xxxxxxxx wrote:

Hi Scott,

thanks for your example. Doesn't do anything to convince me, though. The normals all point in the same direction (and a weird one) and are all flat colored. Changing the POV, the light in the scene or the default light doesn't change anything in the color of the points.

Does this really work for you? Can you send a screenshot?

@Sebastian: Thanks for looking into it!

Best
Timm

On 15/12/2015 at 07:22, xxxxxxxx wrote:

Hi Timm,

We got confirmation that BaseDraw::DrawPointArray() doesn't shade the points.
The normals that can be passed are reserved for later use.

On 15/12/2015 at 07:27, xxxxxxxx wrote:

Hi Yannick,

Originally posted by xxxxxxxx

We got confirmation that BaseDraw::DrawPointArray() doesn't shade the points. The normals that can be passed are reserved for later use.

ok, thanks for the quick confirmation! It might be sensible to mention that in the documentation. But what I'd like to know more: Are there any plans to make this functional soon? That'd allow for some pretty slick editor drawing tricks. ;-)

Best
Timm

On 15/12/2015 at 07:54, xxxxxxxx wrote:

Originally posted by xxxxxxxx

Hi Scott,
Does this really work for you? Can you send a screenshot?

My bad.
When you said "shade". I thought you were talking about the "color" of them.

-ScottA