Open RAX7 opened 2 years ago
what is the difference by using the Program
in the multiple Mesh
you need and then change Mesh.program.uniforms.uTexture
by hand ? Or am I mission something
@Nam-Hai Yep, clone doings fullcopy of programm include a uniforms state. You should know all copies of programm if you want to change uniforms state for all of them.
This is why i did proposal use a Material wrapper that will have shared program/material state.
In some cases it is necessary to create programs with the same shader code but different uniforms (eg texture or color). The
clone
method creates a shallow copy ofProgram
class. Copies all properties by reference except the uniforms. If uniform value has aclone
method (egVec2
,Mat4
), it will be used, otherwise (egTexture
) the value is copied by reference.