1.内置几何体生成代码修订,
2.CAMERA默认znear/zfar修订
This commit is contained in:
parent
8dca542974
commit
42fc94cff9
@ -19,9 +19,6 @@ VK_NAMESPACE_BEGIN
|
|||||||
Texture2D *LoadTGATexture(const OSString &filename,Device *device);
|
Texture2D *LoadTGATexture(const OSString &filename,Device *device);
|
||||||
VK_NAMESPACE_END
|
VK_NAMESPACE_END
|
||||||
|
|
||||||
constexpr uint32_t GBUFFER_WIDTH=1024;
|
|
||||||
constexpr uint32_t GBUFFER_HEIGHT=1024;
|
|
||||||
|
|
||||||
constexpr uint32_t SCREEN_WIDTH=128;
|
constexpr uint32_t SCREEN_WIDTH=128;
|
||||||
constexpr uint32_t SCREEN_HEIGHT=128;
|
constexpr uint32_t SCREEN_HEIGHT=128;
|
||||||
|
|
||||||
@ -83,7 +80,8 @@ private:
|
|||||||
{
|
{
|
||||||
vulkan::Material * material;
|
vulkan::Material * material;
|
||||||
vulkan::DescriptorSets *desc_sets;
|
vulkan::DescriptorSets *desc_sets;
|
||||||
vulkan::Pipeline * pipeline;
|
vulkan::Pipeline * pipeline_line;
|
||||||
|
vulkan::Pipeline * pipeline_solid;
|
||||||
};//
|
};//
|
||||||
|
|
||||||
SubpassParam sp_gbuffer;
|
SubpassParam sp_gbuffer;
|
||||||
@ -151,8 +149,8 @@ private:
|
|||||||
|
|
||||||
bool InitGBuffer()
|
bool InitGBuffer()
|
||||||
{
|
{
|
||||||
gbuffer.extent.width =GBUFFER_WIDTH;
|
gbuffer.extent.width =512;
|
||||||
gbuffer.extent.height =GBUFFER_HEIGHT;
|
gbuffer.extent.height =512;
|
||||||
|
|
||||||
//根据候选格式表选择格式
|
//根据候选格式表选择格式
|
||||||
//const VkFormat position_format =GetCandidateFormat(position_candidate_format, sizeof(position_candidate_format));
|
//const VkFormat position_format =GetCandidateFormat(position_candidate_format, sizeof(position_candidate_format));
|
||||||
@ -166,9 +164,9 @@ private:
|
|||||||
// ||depth_format ==FMT_UNDEFINED)
|
// ||depth_format ==FMT_UNDEFINED)
|
||||||
// return(false);
|
// return(false);
|
||||||
|
|
||||||
const VkFormat position_format =FMT_RGBA16F;
|
const VkFormat position_format =FMT_RGBA32F;
|
||||||
const VkFormat color_format =FMT_RGBA16F;
|
const VkFormat color_format =FMT_RGBA32F;
|
||||||
const VkFormat normal_format =FMT_RGBA16F;
|
const VkFormat normal_format =FMT_RGBA32F;
|
||||||
const VkFormat depth_format =FMT_D32F;
|
const VkFormat depth_format =FMT_D32F;
|
||||||
|
|
||||||
gbuffer.position=device->CreateAttachmentTextureColor(position_format, gbuffer.extent.width,gbuffer.extent.height);
|
gbuffer.position=device->CreateAttachmentTextureColor(position_format, gbuffer.extent.width,gbuffer.extent.height);
|
||||||
@ -230,16 +228,24 @@ private:
|
|||||||
bool InitGBufferPipeline(SubpassParam *sp)
|
bool InitGBufferPipeline(SubpassParam *sp)
|
||||||
{
|
{
|
||||||
AutoDelete<vulkan::PipelineCreater> pipeline_creater=new vulkan::PipelineCreater(device,sp->material,gbuffer.renderpass,gbuffer.extent);
|
AutoDelete<vulkan::PipelineCreater> pipeline_creater=new vulkan::PipelineCreater(device,sp->material,gbuffer.renderpass,gbuffer.extent);
|
||||||
//pipeline_creater->SetCullMode(VK_CULL_MODE_BACK_BIT);
|
|
||||||
pipeline_creater->CloseCullFace();
|
|
||||||
pipeline_creater->Set(PRIM_TRIANGLES);
|
pipeline_creater->Set(PRIM_TRIANGLES);
|
||||||
|
|
||||||
sp->pipeline=pipeline_creater->Create();
|
sp->pipeline_solid=pipeline_creater->Create();
|
||||||
|
|
||||||
if(!sp->pipeline)
|
if(!sp->pipeline_solid)
|
||||||
return(false);
|
return(false);
|
||||||
|
|
||||||
db->Add(sp->pipeline);
|
db->Add(sp->pipeline_solid);
|
||||||
|
|
||||||
|
pipeline_creater->CloseCullFace();
|
||||||
|
pipeline_creater->Set(PRIM_LINES);
|
||||||
|
|
||||||
|
sp->pipeline_line=pipeline_creater->Create();
|
||||||
|
|
||||||
|
if(!sp->pipeline_line)
|
||||||
|
return(false);
|
||||||
|
|
||||||
|
db->Add(sp->pipeline_line);
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,12 +257,12 @@ private:
|
|||||||
pipeline_creater->SetCullMode(VK_CULL_MODE_NONE);
|
pipeline_creater->SetCullMode(VK_CULL_MODE_NONE);
|
||||||
pipeline_creater->Set(PRIM_TRIANGLES);
|
pipeline_creater->Set(PRIM_TRIANGLES);
|
||||||
|
|
||||||
sp->pipeline=pipeline_creater->Create();
|
sp->pipeline_solid=pipeline_creater->Create();
|
||||||
|
|
||||||
if(!sp->pipeline)
|
if(!sp->pipeline_solid)
|
||||||
return(false);
|
return(false);
|
||||||
|
|
||||||
db->Add(sp->pipeline);
|
db->Add(sp->pipeline_solid);
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -270,6 +276,7 @@ private:
|
|||||||
|
|
||||||
texture.color =vulkan::LoadTGATexture(OS_TEXT("res/image/cardboardPlainStain.tga"),device);
|
texture.color =vulkan::LoadTGATexture(OS_TEXT("res/image/cardboardPlainStain.tga"),device);
|
||||||
texture.normal =vulkan::LoadTGATexture(OS_TEXT("res/image/APOCWALL029_NRM.tga"),device);
|
texture.normal =vulkan::LoadTGATexture(OS_TEXT("res/image/APOCWALL029_NRM.tga"),device);
|
||||||
|
//texture.normal =vulkan::LoadTGATexture(OS_TEXT("res/image/flat_normal.tga"),device);
|
||||||
//texture.specular=vulkan::LoadTGATexture(OS_TEXT("res/image/APOCWALL029_SPEC.tga"),device);
|
//texture.specular=vulkan::LoadTGATexture(OS_TEXT("res/image/APOCWALL029_SPEC.tga"),device);
|
||||||
|
|
||||||
VkSamplerCreateInfo sampler_create_info;
|
VkSamplerCreateInfo sampler_create_info;
|
||||||
@ -372,13 +379,12 @@ private:
|
|||||||
bool InitScene(SubpassParam *sp)
|
bool InitScene(SubpassParam *sp)
|
||||||
{
|
{
|
||||||
CreateRenderObject(sp->material);
|
CreateRenderObject(sp->material);
|
||||||
render_root.Add(db->CreateRenderableInstance(sp->pipeline,sp->desc_sets,ro_cube),scale(50,50,50));
|
render_root.Add(db->CreateRenderableInstance(sp->pipeline_line,sp->desc_sets,ro_plane_grid));
|
||||||
render_root.Add(db->CreateRenderableInstance(sp->pipeline,sp->desc_sets,ro_plane_grid));
|
render_root.Add(db->CreateRenderableInstance(sp->pipeline_solid,sp->desc_sets,ro_torus ),translate(0,0,25));
|
||||||
render_root.Add(db->CreateRenderableInstance(sp->pipeline,sp->desc_sets,ro_torus));
|
render_root.Add(db->CreateRenderableInstance(sp->pipeline_solid,sp->desc_sets,ro_sphere ),scale(25,25,25));
|
||||||
render_root.Add(db->CreateRenderableInstance(sp->pipeline,sp->desc_sets,ro_cube ),translate(-10, 0, 5)*scale(10,10,10));
|
render_root.Add(db->CreateRenderableInstance(sp->pipeline_solid,sp->desc_sets,ro_cube ),translate(-16, 0,15)*scale(10,10,10));
|
||||||
render_root.Add(db->CreateRenderableInstance(sp->pipeline,sp->desc_sets,ro_sphere ),translate( 10, 0, 5)*scale(40,40,40));
|
render_root.Add(db->CreateRenderableInstance(sp->pipeline_solid,sp->desc_sets,ro_cylinder ),translate( 16, 16,10)*scale(1,1,2));
|
||||||
render_root.Add(db->CreateRenderableInstance(sp->pipeline,sp->desc_sets,ro_cylinder ),translate( 0, 16, 0));
|
render_root.Add(db->CreateRenderableInstance(sp->pipeline_solid,sp->desc_sets,ro_cone ),translate( 0,-16, 0)*scale(1,1,2));
|
||||||
render_root.Add(db->CreateRenderableInstance(sp->pipeline,sp->desc_sets,ro_cone ),translate( 0,-16, 0));
|
|
||||||
|
|
||||||
render_root.RefreshMatrix();
|
render_root.RefreshMatrix();
|
||||||
render_root.ExpendToList(&render_list);
|
render_root.ExpendToList(&render_list);
|
||||||
|
@ -276,7 +276,9 @@ public:
|
|||||||
camera.width=w;
|
camera.width=w;
|
||||||
camera.height=h;
|
camera.height=h;
|
||||||
camera.center.Set(0,0,0,1);
|
camera.center.Set(0,0,0,1);
|
||||||
camera.eye.Set(100,100,0,1); //xyz三个值不要一样,以方便调试
|
camera.eye.Set(100,100,100,1); //xyz三个值不要一样,以方便调试
|
||||||
|
camera.znear=16;
|
||||||
|
camera.zfar=256;
|
||||||
|
|
||||||
camera.Refresh(); //更新矩阵计算
|
camera.Refresh(); //更新矩阵计算
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ namespace hgl
|
|||||||
float height; ///<视图高
|
float height; ///<视图高
|
||||||
|
|
||||||
float fov=60; ///<水平FOV
|
float fov=60; ///<水平FOV
|
||||||
float znear=0.01,zfar=1024; ///<Z轴上离眼睛的距离
|
float znear=16,zfar=256; ///<Z轴上离眼睛的距离
|
||||||
|
|
||||||
Vector4f eye; ///<眼睛坐标
|
Vector4f eye; ///<眼睛坐标
|
||||||
Vector4f center; ///<视点坐标
|
Vector4f center; ///<视点坐标
|
||||||
|
@ -30,6 +30,7 @@ public:
|
|||||||
operator const VkCommandBuffer *()const{return &cmd_buf;}
|
operator const VkCommandBuffer *()const{return &cmd_buf;}
|
||||||
|
|
||||||
void SetRenderArea(const VkRect2D &ra){render_area=ra;}
|
void SetRenderArea(const VkRect2D &ra){render_area=ra;}
|
||||||
|
void SetViewport(const VkViewport &vp){viewport=vp;}
|
||||||
void SetClearColor(int index,float r,float g,float b,float a=1.0f)
|
void SetClearColor(int index,float r,float g,float b,float a=1.0f)
|
||||||
{
|
{
|
||||||
if(index<0||index>cv_count)return;
|
if(index<0||index>cv_count)return;
|
||||||
|
@ -90,6 +90,11 @@ namespace hgl
|
|||||||
{
|
{
|
||||||
const float f = 1.0f / tan( hgl_ang2rad( 0.5f * field_of_view ) );
|
const float f = 1.0f / tan( hgl_ang2rad( 0.5f * field_of_view ) );
|
||||||
|
|
||||||
|
// float scaleX, shearXy, shearXz, x;
|
||||||
|
//float shearYx, scaleY, shearYz, y;
|
||||||
|
//float shearZx, shearZy, scaleZ, z;
|
||||||
|
//float shearWx, shearWy, shearWz, w;
|
||||||
|
|
||||||
return Matrix4f(
|
return Matrix4f(
|
||||||
f / aspect_ratio, 0.0f, 0.0f, 0.0f,
|
f / aspect_ratio, 0.0f, 0.0f, 0.0f,
|
||||||
0.0f, -f, 0.0f, 0.0f,
|
0.0f, -f, 0.0f, 0.0f,
|
||||||
|
@ -16,12 +16,14 @@ void main()
|
|||||||
{
|
{
|
||||||
outPosition=vec4(normalize(FragmentPosition*2.0-vec3(1.0)),1.0);
|
outPosition=vec4(normalize(FragmentPosition*2.0-vec3(1.0)),1.0);
|
||||||
|
|
||||||
vec3 N = normalize(FragmentNormal);
|
/*vec3 N = normalize(FragmentNormal);
|
||||||
vec3 T = normalize(FragmentTangent);
|
vec3 T = normalize(FragmentTangent);
|
||||||
vec3 B = cross(N,T);
|
vec3 B = cross(N,T);
|
||||||
mat3 TBN = mat3(T,B,N);
|
mat3 TBN = mat3(T,B,N);
|
||||||
vec3 tnorm = normalize(texture(TextureNormal,FragmentTexCoord).xyz*2.0-vec3(1.0))*TBN;
|
vec3 tnorm = (texture(TextureNormal,FragmentTexCoord).xyz*2.0-vec3(1.0))*TBN;
|
||||||
|
|
||||||
outNormal=vec4(tnorm,1.0);
|
outNormal=vec4(normalize(tnorm),1.0);*/
|
||||||
|
outNormal=vec4(normalize(FragmentNormal),1.0);
|
||||||
|
|
||||||
outColor=texture(TextureColor,FragmentTexCoord);
|
outColor=texture(TextureColor,FragmentTexCoord);
|
||||||
}
|
}
|
||||||
|
@ -32,8 +32,10 @@ void main()
|
|||||||
FragmentPosition=(pos*world.modelview).xyz;
|
FragmentPosition=(pos*world.modelview).xyz;
|
||||||
FragmentTexCoord=TexCoord;
|
FragmentTexCoord=TexCoord;
|
||||||
|
|
||||||
mat3 n=mat3(pc.local_to_world*world.modelview);
|
//mat3 n=mat3(pc.local_to_world*world.modelview);
|
||||||
|
|
||||||
FragmentNormal=normalize(Normal)*n;
|
//FragmentNormal=normalize(Normal)*n;
|
||||||
FragmentTangent=normalize(Tangent)*n;
|
//FragmentTangent=normalize(Tangent)*n;
|
||||||
|
FragmentNormal=normalize(Normal);
|
||||||
|
FragmentTangent=normalize(Tangent);
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ PipelineCreater::PipelineCreater(Device *dev,const Material *material,RenderPass
|
|||||||
rasterizer.rasterizerDiscardEnable = VK_FALSE;
|
rasterizer.rasterizerDiscardEnable = VK_FALSE;
|
||||||
rasterizer.polygonMode = VK_POLYGON_MODE_FILL;
|
rasterizer.polygonMode = VK_POLYGON_MODE_FILL;
|
||||||
rasterizer.cullMode = VK_CULL_MODE_BACK_BIT;
|
rasterizer.cullMode = VK_CULL_MODE_BACK_BIT;
|
||||||
rasterizer.frontFace = VK_FRONT_FACE_CLOCKWISE; //顺时针
|
rasterizer.frontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE; //逆时针,和opengl一样
|
||||||
rasterizer.depthBiasEnable = VK_FALSE;
|
rasterizer.depthBiasEnable = VK_FALSE;
|
||||||
rasterizer.depthBiasConstantFactor = 0;
|
rasterizer.depthBiasConstantFactor = 0;
|
||||||
rasterizer.depthBiasClamp = 0;
|
rasterizer.depthBiasClamp = 0;
|
||||||
|
@ -16,9 +16,9 @@ namespace hgl
|
|||||||
|
|
||||||
V nup=cross(side,forward);
|
V nup=cross(side,forward);
|
||||||
|
|
||||||
Matrix4f result( side.x, side.y, side.z, 0.0f,
|
Matrix4f result( side.x, side.y, side.z, 1.0f,
|
||||||
nup.x, nup.y, nup.z, 0.0f,
|
nup.x, nup.y, nup.z, 1.0f,
|
||||||
-forward.x, -forward.y, -forward.z/2.0f, 0.0f,
|
-forward.x, -forward.y, -forward.z/2.0f, 1.0f,
|
||||||
0.0f, 0.0f, 0.0f, 1.0f);
|
0.0f, 0.0f, 0.0f, 1.0f);
|
||||||
// ^^^^^^
|
// ^^^^^^
|
||||||
// 某些引擎此项为0.5,这个会影响最终输出的z值,但我们这里必须为0
|
// 某些引擎此项为0.5,这个会影响最终输出的z值,但我们这里必须为0
|
||||||
|
@ -417,12 +417,12 @@ namespace hgl
|
|||||||
for (uint j = 0; j < numberSlices; j++)
|
for (uint j = 0; j < numberSlices; j++)
|
||||||
{
|
{
|
||||||
*tp= i * (numberSlices + 1) + j; ++tp;
|
*tp= i * (numberSlices + 1) + j; ++tp;
|
||||||
*tp=(i + 1) * (numberSlices + 1) + j; ++tp;
|
|
||||||
*tp=(i + 1) * (numberSlices + 1) + (j + 1); ++tp;
|
*tp=(i + 1) * (numberSlices + 1) + (j + 1); ++tp;
|
||||||
|
*tp=(i + 1) * (numberSlices + 1) + j; ++tp;
|
||||||
|
|
||||||
*tp= i * (numberSlices + 1) + j; ++tp;
|
*tp= i * (numberSlices + 1) + j; ++tp;
|
||||||
*tp=(i + 1) * (numberSlices + 1) + (j + 1); ++tp;
|
|
||||||
*tp= i * (numberSlices + 1) + (j + 1); ++tp;
|
*tp= i * (numberSlices + 1) + (j + 1); ++tp;
|
||||||
|
*tp=(i + 1) * (numberSlices + 1) + (j + 1); ++tp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -533,9 +533,9 @@ namespace hgl
|
|||||||
{
|
{
|
||||||
for (uint j = 0; j < numberSlices + 1; j++)
|
for (uint j = 0; j < numberSlices + 1; j++)
|
||||||
{
|
{
|
||||||
float x=sin(angleStep * (double) i) * sin(angleStep * (double) j);
|
float x= sin(angleStep * (double) i) * sin(angleStep * (double) j);
|
||||||
float y=sin(angleStep * (double) i) * cos(angleStep * (double) j);
|
float y= sin(angleStep * (double) i) * cos(angleStep * (double) j);
|
||||||
float z=cos(angleStep * (double) i);
|
float z=-cos(angleStep * (double) i);
|
||||||
|
|
||||||
*vp=x;++vp;
|
*vp=x;++vp;
|
||||||
*vp=y;++vp;
|
*vp=y;++vp;
|
||||||
@ -614,9 +614,9 @@ namespace hgl
|
|||||||
uint tangentIndex = (i * (dci->numberSlices + 1) + j) * 3;
|
uint tangentIndex = (i * (dci->numberSlices + 1) + j) * 3;
|
||||||
uint texCoordsIndex = (i * (dci->numberSlices + 1) + j) * 2;
|
uint texCoordsIndex = (i * (dci->numberSlices + 1) + j) * 2;
|
||||||
|
|
||||||
float x=dci->radius * sinf(angleStep * (float) i) * sinf(angleStep * (float) j);
|
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 y= dci->radius * sinf(angleStep * (float) i) * cosf(angleStep * (float) j);
|
||||||
float z=dci->radius * cosf(angleStep * (float) i);
|
float z=-dci->radius * cosf(angleStep * (float) i);
|
||||||
|
|
||||||
*vp=x;++vp;
|
*vp=x;++vp;
|
||||||
*vp=y;++vp;
|
*vp=y;++vp;
|
||||||
@ -678,13 +678,13 @@ namespace hgl
|
|||||||
|
|
||||||
// first triangle of the face, counter clock wise winding
|
// first triangle of the face, counter clock wise winding
|
||||||
*tp = v0; ++tp;
|
*tp = v0; ++tp;
|
||||||
*tp = v1; ++tp;
|
|
||||||
*tp = v2; ++tp;
|
*tp = v2; ++tp;
|
||||||
|
*tp = v1; ++tp;
|
||||||
|
|
||||||
// second triangle of the face, counter clock wise winding
|
// second triangle of the face, counter clock wise winding
|
||||||
*tp = v0; ++tp;
|
*tp = v0; ++tp;
|
||||||
*tp = v2; ++tp;
|
|
||||||
*tp = v3; ++tp;
|
*tp = v3; ++tp;
|
||||||
|
*tp = v2; ++tp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -751,7 +751,7 @@ namespace hgl
|
|||||||
|
|
||||||
// generate vertex and stores it in the right position
|
// generate vertex and stores it in the right position
|
||||||
*vp = (centerRadius + torusRadius * cos2PIt) * cos2PIs; ++vp;
|
*vp = (centerRadius + torusRadius * cos2PIt) * cos2PIs; ++vp;
|
||||||
*vp = (centerRadius + torusRadius * cos2PIt) * sin2PIs; ++vp;
|
*vp =-(centerRadius + torusRadius * cos2PIt) * sin2PIs; ++vp;
|
||||||
*vp = torusRadius * sin2PIt; ++vp;
|
*vp = torusRadius * sin2PIt; ++vp;
|
||||||
|
|
||||||
if(np)
|
if(np)
|
||||||
@ -760,7 +760,7 @@ namespace hgl
|
|||||||
// NOTE: cos (2PIx) = cos (x) and sin (2PIx) = sin (x) so, we can use this formula
|
// NOTE: cos (2PIx) = cos (x) and sin (2PIx) = sin (x) so, we can use this formula
|
||||||
// normal = {cos(2PIs)cos(2PIt) , sin(2PIs)cos(2PIt) ,sin(2PIt)}
|
// normal = {cos(2PIs)cos(2PIt) , sin(2PIs)cos(2PIt) ,sin(2PIt)}
|
||||||
*np = cos2PIs * cos2PIt; ++np;
|
*np = cos2PIs * cos2PIt; ++np;
|
||||||
*np = sin2PIs * cos2PIt; ++np;
|
*np =-sin2PIs * cos2PIt; ++np;
|
||||||
*np = sin2PIt; ++np;
|
*np = sin2PIt; ++np;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -867,13 +867,13 @@ namespace hgl
|
|||||||
|
|
||||||
*vp = 0.0f; ++vp;
|
*vp = 0.0f; ++vp;
|
||||||
*vp = 0.0f; ++vp;
|
*vp = 0.0f; ++vp;
|
||||||
*vp = -cci->halfExtend; ++vp;
|
*vp = cci->halfExtend; ++vp;
|
||||||
|
|
||||||
if(np)
|
if(np)
|
||||||
{
|
{
|
||||||
*np = 0.0f; ++np;
|
*np = 0.0f; ++np;
|
||||||
*np = 0.0f; ++np;
|
*np = 0.0f; ++np;
|
||||||
*np = -1.0f; ++np;
|
*np = 1.0f; ++np;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tp)
|
if(tp)
|
||||||
@ -895,13 +895,13 @@ namespace hgl
|
|||||||
|
|
||||||
*vp = cosf(currentAngle) * cci->radius;++vp;
|
*vp = cosf(currentAngle) * cci->radius;++vp;
|
||||||
*vp = -sinf(currentAngle) * cci->radius;++vp;
|
*vp = -sinf(currentAngle) * cci->radius;++vp;
|
||||||
*vp = -cci->halfExtend; ++vp;
|
*vp = cci->halfExtend; ++vp;
|
||||||
|
|
||||||
if(np)
|
if(np)
|
||||||
{
|
{
|
||||||
*np = 0.0f; ++np;
|
*np = 0.0f; ++np;
|
||||||
*np = 0.0f; ++np;
|
*np = 0.0f; ++np;
|
||||||
*np = -1.0f; ++np;
|
*np = 1.0f; ++np;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tp)
|
if(tp)
|
||||||
@ -920,13 +920,13 @@ namespace hgl
|
|||||||
|
|
||||||
*vp = 0.0f; ++vp;
|
*vp = 0.0f; ++vp;
|
||||||
*vp = 0.0f; ++vp;
|
*vp = 0.0f; ++vp;
|
||||||
*vp = cci->halfExtend; ++vp;
|
*vp =-cci->halfExtend; ++vp;
|
||||||
|
|
||||||
if(np)
|
if(np)
|
||||||
{
|
{
|
||||||
*np = 0.0f; ++np;
|
*np = 0.0f; ++np;
|
||||||
*np = 0.0f; ++np;
|
*np = 0.0f; ++np;
|
||||||
*np = 1.0f; ++np;
|
*np = -1.0f; ++np;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tp)
|
if(tp)
|
||||||
@ -948,13 +948,13 @@ namespace hgl
|
|||||||
|
|
||||||
*vp = cosf(currentAngle) * cci->radius;++vp;
|
*vp = cosf(currentAngle) * cci->radius;++vp;
|
||||||
*vp = -sinf(currentAngle) * cci->radius;++vp;
|
*vp = -sinf(currentAngle) * cci->radius;++vp;
|
||||||
*vp = cci->halfExtend; ++vp;
|
*vp = -cci->halfExtend; ++vp;
|
||||||
|
|
||||||
if(np)
|
if(np)
|
||||||
{
|
{
|
||||||
*np = 0.0f; ++np;
|
*np = 0.0f; ++np;
|
||||||
*np = 0.0f; ++np;
|
*np = 0.0f; ++np;
|
||||||
*np = 1.0f; ++np;
|
*np = -1.0f; ++np;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tp)
|
if(tp)
|
||||||
@ -981,7 +981,7 @@ namespace hgl
|
|||||||
{
|
{
|
||||||
*vp = cosf(currentAngle) * cci->radius; ++vp;
|
*vp = cosf(currentAngle) * cci->radius; ++vp;
|
||||||
*vp = -sinf(currentAngle) * cci->radius; ++vp;
|
*vp = -sinf(currentAngle) * cci->radius; ++vp;
|
||||||
*vp = cci->halfExtend * sign; ++vp;
|
*vp = -cci->halfExtend * sign; ++vp;
|
||||||
|
|
||||||
if(np)
|
if(np)
|
||||||
{
|
{
|
||||||
@ -1028,8 +1028,8 @@ namespace hgl
|
|||||||
for (i = 0; i < numberSlices; i++)
|
for (i = 0; i < numberSlices; i++)
|
||||||
{
|
{
|
||||||
*tp = centerIndex; ++tp;
|
*tp = centerIndex; ++tp;
|
||||||
*tp = indexCounter + 1; ++tp;
|
|
||||||
*tp = indexCounter; ++tp;
|
*tp = indexCounter; ++tp;
|
||||||
|
*tp = indexCounter + 1; ++tp;
|
||||||
|
|
||||||
indexCounter++;
|
indexCounter++;
|
||||||
}
|
}
|
||||||
@ -1041,12 +1041,12 @@ namespace hgl
|
|||||||
for (i = 0; i < numberSlices; i++)
|
for (i = 0; i < numberSlices; i++)
|
||||||
{
|
{
|
||||||
*tp = indexCounter; ++tp;
|
*tp = indexCounter; ++tp;
|
||||||
*tp = indexCounter + 1; ++tp;
|
|
||||||
*tp = indexCounter + numberSlices + 1; ++tp;
|
*tp = indexCounter + numberSlices + 1; ++tp;
|
||||||
|
*tp = indexCounter + 1; ++tp;
|
||||||
|
|
||||||
*tp = indexCounter + 1; ++tp;
|
*tp = indexCounter + 1; ++tp;
|
||||||
*tp = indexCounter + numberSlices + 2; ++tp;
|
|
||||||
*tp = indexCounter + numberSlices + 1; ++tp;
|
*tp = indexCounter + numberSlices + 1; ++tp;
|
||||||
|
*tp = indexCounter + numberSlices + 2; ++tp;
|
||||||
|
|
||||||
indexCounter++;
|
indexCounter++;
|
||||||
}
|
}
|
||||||
@ -1084,13 +1084,13 @@ namespace hgl
|
|||||||
|
|
||||||
*vp = 0.0f; ++vp;
|
*vp = 0.0f; ++vp;
|
||||||
*vp = 0.0f; ++vp;
|
*vp = 0.0f; ++vp;
|
||||||
*vp = -cci->halfExtend; ++vp;
|
*vp = cci->halfExtend; ++vp;
|
||||||
|
|
||||||
if(np)
|
if(np)
|
||||||
{
|
{
|
||||||
*np = 0.0f;++np;
|
*np = 0.0f;++np;
|
||||||
*np = 0.0f;++np;
|
*np = 0.0f;++np;
|
||||||
*np = -1.0f;++np;
|
*np = 1.0f;++np;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tp)
|
if(tp)
|
||||||
@ -1112,13 +1112,13 @@ namespace hgl
|
|||||||
|
|
||||||
*vp = cosf(currentAngle) * cci->radius;++vp;
|
*vp = cosf(currentAngle) * cci->radius;++vp;
|
||||||
*vp = -sinf(currentAngle) * cci->radius;++vp;
|
*vp = -sinf(currentAngle) * cci->radius;++vp;
|
||||||
*vp = -cci->halfExtend; ++vp;
|
*vp = cci->halfExtend; ++vp;
|
||||||
|
|
||||||
if(np)
|
if(np)
|
||||||
{
|
{
|
||||||
*np = 0.0f;++np;
|
*np = 0.0f;++np;
|
||||||
*np = 0.0f;++np;
|
*np = 0.0f;++np;
|
||||||
*np = -1.0f;++np;
|
*np = 1.0f;++np;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tp)
|
if(tp)
|
||||||
@ -1145,13 +1145,13 @@ namespace hgl
|
|||||||
|
|
||||||
*vp = cosf(currentAngle) * cci->radius * (1.0f - level); ++vp;
|
*vp = cosf(currentAngle) * cci->radius * (1.0f - level); ++vp;
|
||||||
*vp = -sinf(currentAngle) * cci->radius * (1.0f - level); ++vp;
|
*vp = -sinf(currentAngle) * cci->radius * (1.0f - level); ++vp;
|
||||||
*vp = -cci->halfExtend + 2.0f * cci->halfExtend * level; ++vp;
|
*vp = cci->halfExtend + 2.0f * cci->halfExtend * level; ++vp;
|
||||||
|
|
||||||
if(np)
|
if(np)
|
||||||
{
|
{
|
||||||
*np = h / l * cosf(currentAngle); ++np;
|
*np = h / l * cosf(currentAngle); ++np;
|
||||||
*np = h / l * -sinf(currentAngle); ++np;
|
*np = h / l * -sinf(currentAngle); ++np;
|
||||||
*np = r / l; ++np;
|
*np =-r / l; ++np;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tp)
|
if(tp)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user