修复GeometryCreater缓冲区出错的问题
This commit is contained in:
parent
9a22fa937b
commit
07800559cc
@ -231,6 +231,8 @@ public:
|
|||||||
{
|
{
|
||||||
int index=AcquireNextImage();
|
int index=AcquireNextImage();
|
||||||
|
|
||||||
|
if(index<0||index>swap_chain_count)return;
|
||||||
|
|
||||||
SubmitDraw(index);
|
SubmitDraw(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ namespace hgl
|
|||||||
vulkan::Renderable *CreateRenderableRectangle(SceneDB *db,vulkan::Material *mtl,const RectangleCreateInfo *rci);
|
vulkan::Renderable *CreateRenderableRectangle(SceneDB *db,vulkan::Material *mtl,const RectangleCreateInfo *rci);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 圆角矩形创建信息(扇形)
|
* 圆角矩形创建信息(扇形/线圈)
|
||||||
*/
|
*/
|
||||||
struct RoundRectangleCreateInfo:public RectangleCreateInfo
|
struct RoundRectangleCreateInfo:public RectangleCreateInfo
|
||||||
{
|
{
|
||||||
@ -43,7 +43,7 @@ namespace hgl
|
|||||||
};//struct CircleCreateInfo
|
};//struct CircleCreateInfo
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建一个2D圆形(扇形)
|
* 创建一个2D圆形(扇形/线圈)
|
||||||
*/
|
*/
|
||||||
vulkan::Renderable *CreateRenderableCircle(SceneDB *db,vulkan::Material *mtl,const CircleCreateInfo *rci);
|
vulkan::Renderable *CreateRenderableCircle(SceneDB *db,vulkan::Material *mtl,const CircleCreateInfo *rci);
|
||||||
|
|
||||||
|
@ -74,11 +74,11 @@ namespace hgl
|
|||||||
void WriteTangent (const float *v){if(tangent )tangent ->BufferData(v);}
|
void WriteTangent (const float *v){if(tangent )tangent ->BufferData(v);}
|
||||||
void WriteTexCoord (const float *v){if(tex_coord )tex_coord ->BufferData(v);}
|
void WriteTexCoord (const float *v){if(tex_coord )tex_coord ->BufferData(v);}
|
||||||
|
|
||||||
VERTEX_VB_FORMAT * GetVertex (){return vertex; }
|
VERTEX_VB_FORMAT * GetVertex (){if(!vertex)return nullptr;vertex->Begin();return vertex; }
|
||||||
VB4f * GetColor (){return color; }
|
VB4f * GetColor (){if(!color)return nullptr;color->Begin();return color; }
|
||||||
VB3f * GetNormal (){return normal; }
|
VB3f * GetNormal (){if(!normal)return nullptr;normal->Begin();return normal; }
|
||||||
VB3f * GetTangent (){return tangent; }
|
VB3f * GetTangent (){if(!tangent)return nullptr;tangent->Begin();return tangent; }
|
||||||
VB2f * GetTexCoord (){return tex_coord; }
|
VB2f * GetTexCoord (){if(!tex_coord)return nullptr;tex_coord->Begin();return tex_coord; }
|
||||||
|
|
||||||
float *GetVertexPointer (){return vertex ?(float *)vertex ->Begin():nullptr;}
|
float *GetVertexPointer (){return vertex ?(float *)vertex ->Begin():nullptr;}
|
||||||
float *GetColorPointer (){return color ?(float *)color ->Begin():nullptr;}
|
float *GetColorPointer (){return color ?(float *)color ->Begin():nullptr;}
|
||||||
@ -231,14 +231,12 @@ namespace hgl
|
|||||||
{
|
{
|
||||||
GeometryCreater2D gc(db,mtl);
|
GeometryCreater2D gc(db,mtl);
|
||||||
|
|
||||||
if(!gc.Init(cci->field_count+2))
|
if(!gc.Init(cci->field_count))
|
||||||
return(nullptr);
|
return(nullptr);
|
||||||
|
|
||||||
VB2f *vertex=gc.GetVertex();
|
VB2f *vertex=gc.GetVertex();
|
||||||
|
|
||||||
vertex->Write(cci->center.x,cci->center.y);
|
for(uint i=0;i<cci->field_count;i++)
|
||||||
|
|
||||||
for(uint i=0;i<=cci->field_count;i++)
|
|
||||||
{
|
{
|
||||||
float ang=float(i)/float(cci->field_count)*360.0f;
|
float ang=float(i)/float(cci->field_count)*360.0f;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user