-
Notifications
You must be signed in to change notification settings - Fork 65
Mesh loaders kevin #894
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: mesh_loaders
Are you sure you want to change the base?
Mesh loaders kevin #894
Conversation
static uint8_t packSnorm(float val) | ||
{ | ||
return round(hlsl::clamp(val, -1.0f, 1.0f) * 127); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cpp_compat/intrinsics.hlsl
has those
hlsl::vector<int8_t,3>(0, 0, 127), | ||
hlsl::vector<int8_t,3>(0, 0, 1), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
huh ? you've made a bug
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah sorry
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
.format = EF_R16_UINT, | ||
.rangeFormat = IGeometryBase::EAABBFormat::U16 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you defined index_t = uint32_t
... then format should be R16 and U16 respectively
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
|
||
// Create vertex attributes with NONE usage because we have no clue how they'll be used | ||
hlsl::float32_t3* positions; | ||
hlsl::vector<uint8_t, 4>* normals; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
int8_t
// Create vertex attributes with NONE usage because we have no clue how they'll be used | ||
hlsl::float32_t3* positions; | ||
hlsl::vector<uint8_t, 4>* normals; | ||
hlsl::vector<uint8_t, 2>* uvs; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thats not enough precision, you need uint16_t, see the disk code
core::vectorSIMDf normal(&pos.x); | ||
normal.makeSafe3D(); | ||
const auto quantizedNormal = quantNormalCache->quantize<NormalCacheFormat>(normal); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you make the quantization cache work with hlsl::
vector types instead of core::vectorSIMD
(I'm trying to deprecate them)
const uint16_t halfIx = static_cast<uint16_t>(tesselation); | ||
const uint16_t vertexCount = 2 * static_cast<uint16_t>(tesselation); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you may want to protect against overflow and return nullptr when uint16 is not enough for given tessellation (also take the tesselation as uint16)
.composed = { | ||
.encodedDataRange = {.u8=aabb}, | ||
.stride = AttrSize, | ||
.format = EF_R8G8B8A8_UNORM, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
colors should be SRGB
aabb.minVx = hlsl::vector<uint8_t, 4>(0,0,0,0); | ||
aabb.maxVx = hlsl::vector<uint8_t, 4>(255,255,0,0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct this everywhere, the min and max are supposed to be a single value
Actually, since the colors of the geometries are constant, there's no point having them as attributes (we win one less place in the codebase with video::SColor
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I remove all video::SColor argument from create?
auto cylinder = createCylinder(width0, cylinderHeight, tesselationCylinder, vtxColor0); | ||
auto cone = createCone(width1, height-cylinderHeight, tesselationCone, vtxColor1, vtxColor1); | ||
|
||
auto cylinderPositions = reinterpret_cast<position_t*>(cylinder->getPositionView().src.buffer->getPointer()); | ||
auto conePositions = reinterpret_cast<position_t*>(cone->getPositionView().src.buffer->getPointer()); | ||
|
||
const auto cylinderNormals = reinterpret_cast<normal_t*>(cylinder->getNormalView().src.buffer->getPointer()); | ||
const auto coneNormals = reinterpret_cast<normal_t*>(cone->getNormalView().src.buffer->getPointer()); | ||
|
||
const auto cylinderUvs = reinterpret_cast<uv_t*>(cylinder->getAuxAttributeViews()->front().src.buffer->getPointer()); | ||
const auto coneUvs = reinterpret_cast<uv_t*>(cone->getAuxAttributeViews()->front().src.buffer->getPointer()); | ||
|
||
const auto cylinderIndices = cylinder->getIndexView().src.buffer->getPointer(); | ||
const auto coneIndices = cone->getIndexView().src.buffer->getPointer(); | ||
|
||
const auto cylinderVertexCount = cylinder->getPositionView().getElementCount(); | ||
const auto coneVertexCount = cone->getPositionView().getElementCount(); | ||
const auto newArrowVertexCount = cylinderVertexCount + coneVertexCount; | ||
|
||
const auto cylinderIndexCount = cylinder->getVertexReferenceCount(); | ||
const auto coneIndexCount = cone->getVertexReferenceCount(); | ||
const auto newArrowIndexCount = cylinderIndexCount + coneIndexCount; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually. make this function return a geometry collection!
Its a perfect use case! (untouched geometries, just transforms applied)
You can skip rendering the arrow in ex09 (only test with BLAS stuff in 67)
Implement extra geometries