Skip to content

Commit 1d9658e

Browse files
author
devsh
committed
fix bugs in geometry creator and Indexing callback for triangle Fan
1 parent f2f5d01 commit 1d9658e

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/nbl/asset/ICPUPolygonGeometry.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class CTriangleFanIndexingCB final : public IPolygonGeometryBase::IIndexingCallb
122122
void operator()(SContext<uint16_t>& ctx) const override { operator_impl(ctx); }
123123
void operator()(SContext<uint32_t>& ctx) const override { operator_impl(ctx); }
124124

125-
E_PRIMITIVE_TOPOLOGY knownTopology() const override {return EPT_TRIANGLE_STRIP;}
125+
E_PRIMITIVE_TOPOLOGY knownTopology() const override {return EPT_TRIANGLE_FAN;}
126126
};
127127
auto IPolygonGeometryBase::TriangleFan() -> IIndexingCallback*
128128
{

src/nbl/asset/utils/CGeometryCreator.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ core::smart_refctd_ptr<ICPUPolygonGeometry> CGeometryCreator::createRectangle(co
694694
hlsl::float32_t2( size.x,-size.y),
695695
hlsl::float32_t2(-size.x,-size.y)
696696
};
697-
auto buff = ICPUBuffer::create({sizeof(positions),IBuffer::EUF_NONE});
697+
auto buff = ICPUBuffer::create({{sizeof(positions),IBuffer::EUF_NONE},(void*)positions});
698698
shapes::AABB<4,float32_t> aabb;
699699
aabb.minVx = float32_t4(-size,0.f,0.f);
700700
aabb.maxVx = float32_t4( size,0.f,0.f);
@@ -715,7 +715,7 @@ core::smart_refctd_ptr<ICPUPolygonGeometry> CGeometryCreator::createRectangle(co
715715
hlsl::vector<int8_t,4>(0,0,127,0),
716716
hlsl::vector<int8_t,4>(0,0,127,0)
717717
};
718-
auto buff = ICPUBuffer::create({sizeof(normals),IBuffer::EUF_NONE});
718+
auto buff = ICPUBuffer::create({{sizeof(normals),IBuffer::EUF_NONE},(void*)normals});
719719
shapes::AABB<4,int8_t> aabb;
720720
aabb.maxVx = hlsl::vector<int8_t,4>(0,0,127,0);
721721
aabb.minVx = -aabb.maxVx;
@@ -736,7 +736,7 @@ core::smart_refctd_ptr<ICPUPolygonGeometry> CGeometryCreator::createRectangle(co
736736
hlsl::vector<uint8_t,2>(255, 0),
737737
hlsl::vector<uint8_t,2>( 0, 0)
738738
};
739-
auto buff = ICPUBuffer::create({sizeof(uvs),IBuffer::EUF_NONE});
739+
auto buff = ICPUBuffer::create({{sizeof(uvs),IBuffer::EUF_NONE},(void*)uvs});
740740
shapes::AABB<4,uint8_t> aabb;
741741
aabb.minVx = hlsl::vector<uint8_t,4>(0,0,0,0);
742742
aabb.maxVx = hlsl::vector<uint8_t,4>(255,255,0,0);
@@ -843,7 +843,7 @@ core::smart_refctd_ptr<ICPUPolygonGeometry> CGeometryCreator::createDisk(const f
843843
{
844844
const float t = float(i)/float(tesselation);
845845
const float rad = t * 2.f * hlsl::numbers::pi<float>;
846-
*(positions++) = float32_t3(hlsl::sin(rad),hlsl::cos(rad),0.f);
846+
*(positions++) = float32_t2(hlsl::sin(rad),hlsl::cos(rad))*radius;
847847
*(uvs++) = uint16_t2(t*UnityUV+0.5f,0);
848848
}
849849
}

0 commit comments

Comments
 (0)