class
CC_DLLDrawNode:
public
Node
{
:
static
DrawNode*create();
//画实心圆,参数分别是圆心位置、圆半径、圆填充颜色,如果要画空心圆,就把圆当多边形画(这个多边形点数很多而已)
void
drawDot(
const
Vec2&pos,
float
radius,
Color4F&color);
//画线段,从from到to,2*radius是线段的宽度和radius是线段两头半圆形的半径
drawSegment(
Vec2&from,monospace!important; font-size:1em!important; min-height:inherit!important; background:none!important">Vec2&to,monospace!important; font-size:1em!important; min-height:inherit!important; background:none!important">Color4F&color);
//画多边形,verts为点集,count为点数,fillColor为填充颜色,borderWidth为边缘线宽,borderColor为边缘线颜色
drawPolygon(Vec2*verts,monospace!important; font-size:1em!important; min-height:inherit!important; color:gray!important; background:none!important">int
count,monospace!important; font-size:1em!important; min-height:inherit!important; background:none!important">Color4F&fillColor,monospace!important; font-size:1em!important; min-height:inherit!important; background:none!important">borderWidth,monospace!important; font-size:1em!important; min-height:inherit!important; background:none!important">Color4F&borderColor);
//画三角形,三人顶点及其填充色
drawTriangle(
Vec2&p1,monospace!important; font-size:1em!important; min-height:inherit!important; background:none!important">Vec2&p2,monospace!important; font-size:1em!important; min-height:inherit!important; background:none!important">Vec2&p3,monospace!important; font-size:1em!important; min-height:inherit!important; background:none!important">Color4F&color);
//画三次贝塞尔曲线
drawCubicBezier(
Vec2&control1,monospace!important; font-size:1em!important; min-height:inherit!important; background:none!important">Vec2&control2,unsigned
segments,monospace!important; font-size:1em!important; min-height:inherit!important; background:none!important">Color4F&color);
//画二次贝塞尔曲线
drawQuadraticBezier(
Vec2&control,monospace!important; font-size:1em!important; min-height:inherit!important; background:none!important">Color4F&color);
/**Clearthegeometryinthenode'sbuffer.*/
clear();
/**
*@jsNA
*@luaNA
*/
BlendFunc&getBlendFunc()
;
/**
*@code
*Whenthisfunctionboundintojsorlua,theparameterwillbechanged
*Injs:varsetBlendFunc(varsrc,vardst)
*@endcode
*@luaNA
*/
setBlendFunc(
BlendFunc&blendFunc);
onDraw(
Mat4&transform,uint32_tflags);
//新的绘图渲染函数
virtual
draw(Renderer*renderer,uint32_tflags)override;
CC_CONSTRUCTOR_ACCESS:
DrawNode();
virtual
~DrawNode();
virtual
bool
init();
protected
:
ensureCapacity(
count);
GLuint_vao;
GLuint_vbo;
_bufferCapacity;
GLsizei_bufferCount;
V2F_C4B_T2F*_buffer;
BlendFunc_blendFunc;
CustomCommand_customCommand;
_dirty;
private
:
CC_DISALLOW_COPY_AND_ASSIGN(DrawNode);
};