From b0b6e48f8647b6327183149faa8f09584531c356 Mon Sep 17 00:00:00 2001 From: hyzboy Date: Mon, 19 Oct 2020 22:23:39 +0800 Subject: [PATCH] improve the Circle inline-geometry --- src/SceneGraph/InlineGeometry.cpp | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/src/SceneGraph/InlineGeometry.cpp b/src/SceneGraph/InlineGeometry.cpp index 5d76616f..e37db70f 100644 --- a/src/SceneGraph/InlineGeometry.cpp +++ b/src/SceneGraph/InlineGeometry.cpp @@ -116,15 +116,35 @@ namespace hgl { RenderableCreater rc(db,mtl); - if(!rc.Init(cci->field_count)) - return(nullptr); + uint edge; + + if(cci->has_color) + { + edge=cci->field_count+1; + if(!rc.Init(cci->field_count+2))return(nullptr); + } + else + { + edge=cci->field_count; + if(!rc.Init(cci->field_count))return(nullptr); + } AutoDelete vertex=rc.CreateVADA(VAN::Position); + AutoDelete color=rc.CreateVADA(VAN::Color); if(!vertex) return(nullptr); - for(uint i=0;ifield_count;i++) + if(cci->has_color) + { + if(!color) + return(nullptr); + + vertex->Write(cci->center); + color->Write(cci->center_color); + } + + for(uint i=0;ifield_count)*360.0f; @@ -132,6 +152,9 @@ namespace hgl float y=cci->center.y+cos(hgl_ang2rad(ang))*cci->radius.y; vertex->Write(x,y); + + if(cci->has_color) + color->Write(cci->border_color); } return rc.Finish();