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

Fixed 'Optional Texture Embedding' feature #196

Merged
merged 1 commit into from
Jul 29, 2024

Conversation

lufriem
Copy link
Contributor

@lufriem lufriem commented Jul 29, 2024

Description

It seems that commit 68edd8f broke the 'Optional texture embedding' (see PR #172) feature, so that vsgb/vsgt files created using vsgconv will (at best) not work and (at worst) lead to the loading code to crash.

For example it happened to me that I had a top-level CullNode.. the vsg::External object referenced an external texture, but its path was not set/saved (that is the actual bug introduced in the merge), so the StartID_EndID_Filename values were incorrect (an empty object with the ID=3 was created on loading), which means the the vsg::MatrixTransform node was not loaded (since the empty object with ID=3 already cached), so I ended up with a CullNode without child node, which leads to an access violation on traversal (CullNode on purpose does not check for this due to performance considerations)

#vsga 1.1.7
Root id=1 vsg::CullNode
{
userObjects 1
key "external"
object id=2 vsg::External
{
userObjects 0
options id=0
NumEntries 1
StartID_EndID_Filename 3 3 ""
}
bound 2.28881835938e-05 2.22340196371 45.2545385361 63.7056769332
child id=3 vsg::MatrixTransform
{

For reference, after the fix, the file looks like this

#vsga 1.1.7
Root id=1 vsg::CullNode
{
userObjects 1
key "external"
object id=2 vsg::External
{
userObjects 0
options id=0
NumEntries 1
StartID_EndID_Filename 3 4 "myTexture.bmp"
}
bound 2.28881835938e-05 2.22340196371 45.2545385361 63.7056769332
child id=4 vsg::MatrixTransform
{

Fixes #195

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

I converted some test models using vsgconvd.exe, using the command line

  • '--external_textures true --external_texture_format vsgb' and
  • '--external_textures true --external_texture_format native'

then loaded the resulting files into the vsgViewer example

Test Configuration:
Windows 10, VS2022

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@robertosfield robertosfield merged commit cf3e506 into vsg-dev:master Jul 29, 2024
@lufriem lufriem deleted the ExternalTexturesMergeErrorFix branch July 29, 2024 09:40
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.

'Optional texture embedding' feature is broken
2 participants