Skip to content

TSL name collisions #1835

@Methuselah96

Description

@Methuselah96

I'm working on switching from the proxy-based version of TSL to the prototype version (based on mrdoob/three.js#31691). The main problem I'm running into is that there are some naming collisions between the TSL methods and some properties/methods that exist on the Node sub-classes.

For example:

  • StackNode.add() conflicts with the TSL add() method
  • RenderOutputNode.toneMapping and ToneMappingNode.toneMapping conflict with the TSL toneMapping() method
  • StorageBufferNode.element() and UniformArrayNode.element() conflict with the TSL element() method
    • This one might be okay if the method signatures are compatible

We used to be able to handle this to some degree before because any proxied Nodes had a type of ShaderNodeObject<Node> and the ShaderNodeObject type was able to check the specificNode type and not override the method/property if it existed on that Node type. However, this was still not ideal because it meant that some ShaderNodeObject<Node> types were not assignable to others.

This is a more pressing issue now since I'm trying to add the TSL methods to the Node type directly and so the conflicts are more apparent and TypeScript produces errors since the method/properties are not compatible with each other.

One solution I was considering was making it so that some of the TSL methods are only available on some Node types, but that seems like it could get kind of messy.

@sunag @Mugen87 Do you have any thoughts on this or any ideas on how to solve this issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions