Skip to content
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

Update glTF.CPP to 1.5.19 #34

Closed
wants to merge 3 commits into from

Conversation

najadojo
Copy link
Contributor

Update driectxtex to 2018.6.1.2
No functional changes.

Update driectxtex to 2018.6.1.2
@@ -131,13 +131,13 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.0.7</Version>
<Version>6.2.0-Preview1-26502-02</Version>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason why we're using a preview version here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just pushed the update button in NuGet; there is no reason I needed this package updated.

@@ -333,12 +346,13 @@ namespace

for (auto &primitive : mesh.primitives)
{
AddIndexOffset(primitive.positionsAccessorId, accessorOffset);
AddIndexOffset(primitive.normalsAccessorId, accessorOffset);
AddIndexOffset(primitive.indicesAccessorId, accessorOffset);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this correct? or does it have to be changed as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indices is still its own field where empty string implies not present in the json. So no it doesn't need to change.

@robertos
Copy link
Contributor

It would be great to get someone from glTF.CPP to double-check this one @chriche-ms @agrittmsft

@@ -68,7 +78,7 @@ namespace
}

template <typename T>
std::string SerializeExtensionMSFTLod(const T&, const std::vector<std::string>& lods, const GLTFDocument& gltfDocument)
std::string SerializeExtensionMSFTLod(const T&, const std::vector<std::string>& lods, const Document& Document)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer lowercase for variable name

localMaterial.specularGlossiness.diffuseFactor == globalMaterial.specularGlossiness.diffuseFactor &&
localMaterial.specularGlossiness.glossinessFactor == globalMaterial.specularGlossiness.glossinessFactor &&
localMaterial.specularGlossiness.specularFactor == globalMaterial.specularGlossiness.specularFactor;
localMaterial.HasExtension<KHR::Materials::PBRSpecularGlossiness>() == globalMaterial.HasExtension<KHR::Materials::PBRSpecularGlossiness>() &&

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason for not using PBRSpecularGlossiness.IsEqual(other)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the textureIds will/could be different in this comparison.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, in that case can we reduce the number of GetExtension calls to 2? One for localMaterial and one for globalMaterial.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would make this expression a lot more complex (looking).; I'll leave the optimization up to the compiler.

@agrittmsft
Copy link

Thanks for fixing all these breaking changes from our glTF SDK updates @najadojo!

inline void AddIndexOffset(MeshPrimitive& primitive, const char* attributeName, size_t offset)
{
// an empty id string indicates that the id is not inuse and therefore should not be updated
if (primitive.HasAttribute(attributeName))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if it's available in the SDK version you have but MeshPrimitive::TryGetAttributeAccessorId may be better than HasAttribute followed by a find (if available)

AddIndexOffset(material.specularGlossiness.specularGlossinessTextureId, texturesOffset);
if (material.HasExtension<KHR::Materials::PBRSpecularGlossiness>())
{
AddIndexOffset(material.GetExtension<KHR::Materials::PBRSpecularGlossiness>().diffuseTexture.textureId, texturesOffset);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you considered storing the result of GetExtension in a local variable rather than calling the function repeatedly?

@robertos
Copy link
Contributor

robertos commented Jul 9, 2018

Superceded by #36

@robertos robertos closed this Jul 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants