habitat-sim icon indicating copy to clipboard operation
habitat-sim copied to clipboard

Serialize lights into gfx-replay json format.

Open 0mdc opened this issue 3 years ago • 0 comments

Motivation and Context

This changeset adds light serialization to the gfx-replay format.

Lights are serialized incrementally - they are only written to the json file when lighting changes occur. We assume that the keyframes are always read sequentially.

`GfxReplayTest::testLightIntegration` Replay File
{
    "keyframes": [
        {
            "lights": [
                {
                    "light": {
                        "vector": [
                            1.5,
                            2.0,
                            2.5,
                            1.0
                        ],
                        "color": [
                            1.5,
                            2.0,
                            5.0
                        ],
                        "model": "global"
                    }
                },
                {
                    "light": {
                        "vector": [
                            -10.0,
                            4.25,
                            10.0,
                            1.0
                        ],
                        "color": [
                            5.0,
                            5.0,
                            0.0
                        ],
                        "model": "camera"
                    }
                }
            ]
        },
        {
            "lights": [
                {
                    "light": {
                        "vector": [
                            0.0,
                            1.2,
                            -4.0,
                            1.0
                        ],
                        "color": [
                            4.0,
                            4.0,
                            4.0
                        ],
                        "model": "object"
                    }
                }
            ]
        },
        {},
        {
            "lights": [
                {
                    "light": {
                        "vector": [
                            0.1,
                            0.2,
                            -0.3,
                            0.0
                        ],
                        "color": [
                            0.0,
                            0.0,
                            1.0
                        ],
                        "model": "global"
                    }
                }
            ]
        }
    ]
}

How Has This Been Tested

  • New unit test (GfxReplayTest::testLightIntegration).

Types of changes

  • [x] Docs change / refactoring / dependency upgrade
  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • [x] My code follows the code style of this project.
  • [ ] My change requires a change to the documentation.
  • [ ] I have updated the documentation accordingly.
  • [x] I have read the CONTRIBUTING document.
  • [x] I have completed my CLA (see CONTRIBUTING)
  • [x] I have added tests to cover my changes.
  • [x] All new and existing tests passed.

0mdc avatar Sep 07 '22 21:09 0mdc