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

fix and add feature for update sync #54

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jonlepage
Copy link

@jonlepage jonlepage commented May 8, 2023

fix uLightHeight update
fix radius update geometry.
add some cache optimisations
overide destroy: just to be sure gc do it job.

those issue was so long here , now it fixed.

**edit: sry when a save my ide installed a default formater, i reverse change without the uglyfi prettier to keep author formating **


overview

This is a pull request that contains changes to two TypeScript files: src/lights/light/Light.ts and src/lights/pointLight/PointLight.ts.

In Light.ts, there is one change made to the _renderDefault method, which involves adding 47 lines of code and deleting 2 lines.

In PointLight.ts, there are multiple changes made. Firstly, a new constant DEFAULT_SHAPE_SEGMENTS is defined. Then, the PointLight class is modified to add three new properties: shapeCache, verticesCache, and indicesCache. shapeCache is a Circle object that is used to generate a mesh, while verticesCache and indicesCache are arrays used to store the vertices and indices of the mesh, respectively. The _shapeSegments property is also added, which sets the number of segments to use for the Circle mesh.

The constructor of PointLight is modified to take in a new parameter shapeSegments, which is used to set _shapeSegments. A new mesh is generated using the getCircleMesh function and the vertices and indices arrays are passed to the constructor of Light. Additionally, the drawMode property is set to DRAW_MODES.TRIANGLE_FAN.

Two new methods are added to PointLight: set radius and set shapeSegments. The former method updates the value of uLightRadius in the material.uniforms object and updates the buffers of the mesh with new vertices and indices generated using getCircleMesh. The latter method updates the value of _shapeSegments and also updates the mesh.

Finally, the destroy method is overridden to delete the shapeCache, verticesCache, and indicesCache properties before calling the superclass destroy method.
by gpt

jonlepage added 3 commits May 8, 2023 02:00
fix uLightHeight update
fix radius update geometry.
add some cache optimisations
overide destroy: just to be sure gc do it job.
fix uLightHeight update
fix radius update geometry.
add some cache optimisations
overide destroy: just to be sure gc do it job.
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.

1 participant