diff --git a/inc/hgl/graph/VertexAttribData.h b/inc/hgl/graph/VertexAttribData.h index 589434d1..46f913c8 100644 --- a/inc/hgl/graph/VertexAttribData.h +++ b/inc/hgl/graph/VertexAttribData.h @@ -12,7 +12,7 @@ namespace hgl namespace VertexAttribName { #define VAN_DEFINE(name) constexpr char name[]=#name; - VAN_DEFINE(Vertex) + VAN_DEFINE(Position) VAN_DEFINE(Normal) VAN_DEFINE(Color) VAN_DEFINE(Tangent) diff --git a/inc/hgl/graph/font/TextRenderable.h b/inc/hgl/graph/font/TextRenderable.h index 36c35ea7..79ad2af0 100644 --- a/inc/hgl/graph/font/TextRenderable.h +++ b/inc/hgl/graph/font/TextRenderable.h @@ -16,7 +16,7 @@ namespace hgl uint max_count; ///<缓冲区最大容量 - vulkan::VAB * vab_vertex; + vulkan::VAB * vab_position; vulkan::VAB * vab_tex_coord; public: diff --git a/inc/hgl/graph/material/StandardMaterial.h b/inc/hgl/graph/material/StandardMaterial.h index f1cd33c0..dbe81d95 100644 --- a/inc/hgl/graph/material/StandardMaterial.h +++ b/inc/hgl/graph/material/StandardMaterial.h @@ -15,7 +15,7 @@ public: Const, Param, Texture, - Vertex, + Position, };// struct diff --git a/res b/res index 134fa86c..7f2ffa2e 160000 --- a/res +++ b/res @@ -1 +1 @@ -Subproject commit 134fa86c091b40a890c64d7052af8c21d01c209e +Subproject commit 7f2ffa2e7c7cfb308d5eb20019faee68d4652181 diff --git a/src/SceneGraph/InlineGeometry.cpp b/src/SceneGraph/InlineGeometry.cpp index 4b6b9fd6..3265047d 100644 --- a/src/SceneGraph/InlineGeometry.cpp +++ b/src/SceneGraph/InlineGeometry.cpp @@ -19,7 +19,7 @@ namespace hgl if(!rc.Init(4)) return(nullptr); - AutoDelete vertex=rc.CreateVADA(VAN::Vertex); + AutoDelete vertex=rc.CreateVADA(VAN::Position); if(!vertex) return(nullptr); @@ -47,7 +47,7 @@ namespace hgl if(!rc.Init(4)) return(nullptr); - AutoDelete vertex=rc.CreateVADA(VAN::Vertex); + AutoDelete vertex=rc.CreateVADA(VAN::Position); vertex->WriteRectFan(rci->scope); } @@ -61,7 +61,7 @@ namespace hgl if(!rc.Init(rci->round_per*4)) return(nullptr); - AutoDelete vertex=rc.CreateVADA(VAN::Vertex); + AutoDelete vertex=rc.CreateVADA(VAN::Position); vec2 *coord=new vec2[rci->round_per]; @@ -119,7 +119,7 @@ namespace hgl if(!rc.Init(cci->field_count)) return(nullptr); - AutoDelete vertex=rc.CreateVADA(VAN::Vertex); + AutoDelete vertex=rc.CreateVADA(VAN::Position); if(!vertex) return(nullptr); @@ -144,7 +144,7 @@ namespace hgl if(!rc.Init(((pgci->step.u+1)+(pgci->step.v+1))*2)) return(nullptr); - AutoDelete vertex=rc.CreateVADA(VAN::Vertex); + AutoDelete vertex=rc.CreateVADA(VAN::Position); for(uint row=0;row<=pgci->step.u;row++) { float pos=float(row)/float(pgci->step.u); @@ -196,7 +196,7 @@ namespace hgl if(!rc.Init(4)) return(nullptr); - rc.WriteVAD(VAN::Vertex,xy_vertices,sizeof(xy_vertices)); + rc.WriteVAD(VAN::Position,xy_vertices,sizeof(xy_vertices)); { AutoDelete normal=rc.CreateVADA(VAN::Normal); @@ -256,12 +256,12 @@ namespace hgl if(cci->center ==Vector3f(0,0,0) &&cci->size ==Vector3f(1,1,1)) { - rc.WriteVAD(VAN::Vertex,points,sizeof(points)); + rc.WriteVAD(VAN::Position,points,sizeof(points)); } else { const float *sp=points; - AutoDelete vertex=rc.CreateVADA(VAN::Vertex); + AutoDelete vertex=rc.CreateVADA(VAN::Position); float *vp=vertex->Get(); for(uint i=0;i<24;i++) @@ -330,9 +330,9 @@ namespace hgl float halfAngleRadian = hgl_ang2rad(angle) * 0.5f; quaternion[0] = 0.0f; - quaternion[1] = sinf(halfAngleRadian); + quaternion[1] = sin(halfAngleRadian); quaternion[2] = 0.0f; - quaternion[3] = cosf(halfAngleRadian); + quaternion[3] = cos(halfAngleRadian); } void glusQuaternionRotateRzf(float quaternion[4], const float angle) @@ -341,8 +341,8 @@ namespace hgl quaternion[0] = 0.0f; quaternion[1] = 0.0f; - quaternion[2] = sinf(halfAngleRadian); - quaternion[3] = cosf(halfAngleRadian); + quaternion[2] = sin(halfAngleRadian); + quaternion[3] = cos(halfAngleRadian); } void glusQuaternionGetMatrix4x4f(float matrix[16], const float quaternion[4]) @@ -415,7 +415,7 @@ namespace hgl if(!rc.Init(numberVertices)) return(nullptr); - AutoDelete vertex=rc.CreateVADA(VAN::Vertex); + AutoDelete vertex=rc.CreateVADA(VAN::Position); AutoDelete normal=rc.CreateVADA(VAN::Normal); AutoDelete tangent=rc.CreateVADA(VAN::Tangent); AutoDelete tex_coord=rc.CreateVADA(VAN::TexCoord); @@ -496,7 +496,7 @@ namespace hgl if(!rc.Init(numberVertices)) return(nullptr); - AutoDelete vertex=rc.CreateVADA(VAN::Vertex); + AutoDelete vertex=rc.CreateVADA(VAN::Position); AutoDelete normal=rc.CreateVADA(VAN::Normal); AutoDelete tangent=rc.CreateVADA(VAN::Tangent); AutoDelete tex_coord=rc.CreateVADA(VAN::TexCoord); @@ -515,9 +515,9 @@ namespace hgl uint tangentIndex = (i * (dci->numberSlices + 1) + j) * 3; uint texCoordsIndex = (i * (dci->numberSlices + 1) + j) * 2; - float x= dci->radius * sinf(angleStep * (float) i) * sinf(angleStep * (float) j); - float y= dci->radius * sinf(angleStep * (float) i) * cosf(angleStep * (float) j); - float z= dci->radius * cosf(angleStep * (float) i); + float x= dci->radius * sin(angleStep * (double) i) * sin(angleStep * (double) j); + float y= dci->radius * sin(angleStep * (double) i) * cos(angleStep * (double) j); + float z= dci->radius * cos(angleStep * (double) i); *vp=x;++vp; *vp=y;++vp; @@ -631,7 +631,7 @@ namespace hgl if(!rc.Init(numberVertices)) return(nullptr); - AutoDelete vertex=rc.CreateVADA(VAN::Vertex); + AutoDelete vertex=rc.CreateVADA(VAN::Position); AutoDelete normal=rc.CreateVADA(VAN::Normal); AutoDelete tangent=rc.CreateVADA(VAN::Tangent); AutoDelete tex_coord=rc.CreateVADA(VAN::TexCoord); @@ -645,15 +645,15 @@ namespace hgl for (sideCount = 0; sideCount <= tci->numberSlices; ++sideCount, s += sIncr) { // precompute some values - cos2PIs = (float) cosf(2.0f * HGL_PI * s); - sin2PIs = (float) sinf(2.0f * HGL_PI * s); + cos2PIs = cos(2.0f * HGL_PI * s); + sin2PIs = sin(2.0f * HGL_PI * s); t = 0.0f; for (faceCount = 0; faceCount <= tci->numberStacks; ++faceCount, t += tIncr) { // precompute some values - cos2PIt = (float) cosf(2.0f * HGL_PI * t); - sin2PIt = (float) sinf(2.0f * HGL_PI * t); + cos2PIt = cos(2.0f * HGL_PI * t); + sin2PIt = sin(2.0f * HGL_PI * t); // generate vertex and stores it in the right position *vp = (centerRadius + torusRadius * cos2PIt) * cos2PIs; ++vp; @@ -766,7 +766,7 @@ namespace hgl if (cci->numberSlices < 3 || numberVertices > GLUS_MAX_VERTICES || numberIndices > GLUS_MAX_INDICES) return nullptr; - AutoDelete vertex=rc.CreateVADA(VAN::Vertex); + AutoDelete vertex=rc.CreateVADA(VAN::Position); AutoDelete normal=rc.CreateVADA(VAN::Normal); AutoDelete tangent=rc.CreateVADA(VAN::Tangent); AutoDelete tex_coord=rc.CreateVADA(VAN::TexCoord); @@ -804,8 +804,8 @@ namespace hgl { float currentAngle = angleStep * (float)i; - *vp = cosf(currentAngle) * cci->radius;++vp; - *vp = -sinf(currentAngle) * cci->radius;++vp; + *vp = cos(currentAngle) * cci->radius; ++vp; + *vp = -sin(currentAngle) * cci->radius; ++vp; *vp = -cci->halfExtend; ++vp; if(np) @@ -817,8 +817,8 @@ namespace hgl if(tp) { - *tp = sinf(currentAngle); ++tp; - *tp = cosf(currentAngle); ++tp; + *tp = sin(currentAngle); ++tp; + *tp = cos(currentAngle); ++tp; *tp = 0.0f; ++tp; } @@ -857,8 +857,8 @@ namespace hgl { float currentAngle = angleStep * (float)i; - *vp = cosf(currentAngle) * cci->radius;++vp; - *vp = -sinf(currentAngle) * cci->radius;++vp; + *vp = cos(currentAngle) * cci->radius; ++vp; + *vp = -sin(currentAngle) * cci->radius; ++vp; *vp = cci->halfExtend; ++vp; if(np) @@ -870,8 +870,8 @@ namespace hgl if(tp) { - *tp = -sinf(currentAngle); ++tp; - *tp = -cosf(currentAngle); ++tp; + *tp = -sin(currentAngle); ++tp; + *tp = -cos(currentAngle); ++tp; *tp = 0.0f; ++tp; } @@ -890,21 +890,21 @@ namespace hgl for (uint j = 0; j < 2; j++) { - *vp = cosf(currentAngle) * cci->radius; ++vp; - *vp = -sinf(currentAngle) * cci->radius; ++vp; + *vp = cos(currentAngle) * cci->radius; ++vp; + *vp = -sin(currentAngle) * cci->radius; ++vp; *vp = cci->halfExtend * sign; ++vp; if(np) { - *np = cosf(currentAngle); ++np; - *np = -sinf(currentAngle); ++np; + *np = cos(currentAngle); ++np; + *np = -sin(currentAngle); ++np; *np = 0.0f; ++np; } if(tp) { - *tp = -sinf(currentAngle); ++tp; - *tp = -cosf(currentAngle); ++tp; + *tp = -sin(currentAngle); ++tp; + *tp = -cos(currentAngle); ++tp; *tp = 0.0f; ++tp; } @@ -988,7 +988,7 @@ namespace hgl if (cci->numberSlices < 3 || cci->numberStacks < 1 || numberVertices > GLUS_MAX_VERTICES || numberIndices > GLUS_MAX_INDICES) return nullptr; - AutoDelete vertex=rc.CreateVADA(VAN::Vertex); + AutoDelete vertex=rc.CreateVADA(VAN::Position); AutoDelete normal=rc.CreateVADA(VAN::Normal); AutoDelete tangent=rc.CreateVADA(VAN::Tangent); AutoDelete tex_coord=rc.CreateVADA(VAN::TexCoord); @@ -1026,8 +1026,8 @@ namespace hgl { float currentAngle = angleStep * (float)i; - *vp = cosf(currentAngle) * cci->radius;++vp; - *vp = -sinf(currentAngle) * cci->radius;++vp; + *vp = cos(currentAngle) * cci->radius; ++vp; + *vp = -sin(currentAngle) * cci->radius; ++vp; *vp = -cci->halfExtend; ++vp; if(np) @@ -1039,8 +1039,8 @@ namespace hgl if(tp) { - *tp = sinf(currentAngle); ++tp; - *tp = cosf(currentAngle); ++tp; + *tp = sin(currentAngle); ++tp; + *tp = cos(currentAngle); ++tp; *tp = 0.0f; ++tp; } @@ -1059,21 +1059,21 @@ namespace hgl { float currentAngle = angleStep * (float)i; - *vp = cosf(currentAngle) * cci->radius * (1.0f - level); ++vp; - *vp = -sinf(currentAngle) * cci->radius * (1.0f - level); ++vp; + *vp = cos(currentAngle) * cci->radius * (1.0f - level); ++vp; + *vp = -sin(currentAngle) * cci->radius * (1.0f - level); ++vp; *vp = -cci->halfExtend + 2.0f * cci->halfExtend * level; ++vp; if(np) { - *np = h / l * cosf(currentAngle); ++np; - *np = h / l * -sinf(currentAngle); ++np; + *np = h / l * cos(currentAngle); ++np; + *np = h / l * -sin(currentAngle); ++np; *np = r / l; ++np; } if(tp) { - *tp = -sinf(currentAngle); ++tp; - *tp = -cosf(currentAngle); ++tp; + *tp = -sin(currentAngle); ++tp; + *tp = -cos(currentAngle); ++tp; *tp = 0.0f; ++tp; } @@ -1100,7 +1100,7 @@ namespace hgl if(!rc.Init(6)) return(nullptr); - AutoDelete vertex=rc.CreateVADA(VAN::Vertex); + AutoDelete vertex=rc.CreateVADA(VAN::Position); AutoDelete color=rc.CreateVADA(VAN::Color); if(!vertex||!color) @@ -1145,14 +1145,14 @@ namespace hgl if(!rc.Init(8)) return(nullptr); - AutoDelete vertex=rc.CreateVADA(VAN::Vertex); + AutoDelete vertex=rc.CreateVADA(VAN::Position); if(!vertex)return(nullptr); if(cci->center ==Vector3f(0,0,0) &&cci->size ==Vector3f(1,1,1)) { - rc.WriteVAD(VAN::Vertex,points,sizeof(points)); + rc.WriteVAD(VAN::Position,points,sizeof(points)); } else { diff --git a/src/SceneGraph/font/TextLayout.cpp b/src/SceneGraph/font/TextLayout.cpp index cf72e6fe..73ab927b 100644 --- a/src/SceneGraph/font/TextLayout.cpp +++ b/src/SceneGraph/font/TextLayout.cpp @@ -145,7 +145,7 @@ namespace hgl // if(!rc->Init(draw_chars_count)) // return(-4); - // vertex =rc->CreateVADA(VAN::Vertex); + // vertex =rc->CreateVADA(VAN::Position); // tex_coord =rc->CreateVADA(VAN::TexCoord); // if(!vertex||!tex_coord) diff --git a/src/SceneGraph/font/TextRenderable.cpp b/src/SceneGraph/font/TextRenderable.cpp index ae3b9560..e71e7df2 100644 --- a/src/SceneGraph/font/TextRenderable.cpp +++ b/src/SceneGraph/font/TextRenderable.cpp @@ -13,14 +13,14 @@ namespace hgl max_count=0; - vab_vertex=nullptr; + vab_position=nullptr; vab_tex_coord=nullptr; } TextRenderable::~TextRenderable() { SAFE_CLEAR(vab_tex_coord); - SAFE_CLEAR(vab_vertex); + SAFE_CLEAR(vab_position); } void TextRenderable::SetCharCount(const uint cc) @@ -31,11 +31,11 @@ namespace hgl max_count=power_to_2(cc); { - if(vab_vertex) - delete vab_vertex; + if(vab_position) + delete vab_position; - vab_vertex =device->CreateVAB(VAF_VEC4,max_count); - Set(VAN::Vertex,vab_vertex); + vab_position =device->CreateVAB(VAF_VEC4,max_count); + Set(VAN::Position,vab_position); } { @@ -47,7 +47,7 @@ namespace hgl } } - bool TextRenderable::WriteVertex (const float *fp){if(!fp)return(false);if(!vab_vertex )return(false);return vab_vertex ->Write(fp,draw_count*4*sizeof(float));} + bool TextRenderable::WriteVertex (const float *fp){if(!fp)return(false);if(!vab_position )return(false);return vab_position ->Write(fp,draw_count*4*sizeof(float));} bool TextRenderable::WriteTexCoord (const float *fp){if(!fp)return(false);if(!vab_tex_coord)return(false);return vab_tex_coord ->Write(fp,draw_count*4*sizeof(float));} }//namespace graph }//namespace hgl