@volter/blender-engine 0.1.126 → 0.1.127
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -159,6 +159,16 @@ export function syncPhysicalDrawMaterial(source: THREE.Material, target?: THREE.
|
|
|
159
159
|
return copy;
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
+
/** A copy of a presented material that ONE object can wear and a script can recolour (Model
|
|
163
|
+
* Play's `tint`/`setOpacity`): the same hooks, physical values, maps and private uniforms,
|
|
164
|
+
* drawn from the material's constants -- `color`, `opacity`, `map`, `emissive` -- with no
|
|
165
|
+
* node graph, since a graph's Base Color and Alpha replace those constants in the shader.
|
|
166
|
+
* Null for a material that is not one of the presenter's. The caller owns and disposes it. */
|
|
167
|
+
export function ownedSurfaceMaterial(source: THREE.Material): THREE.MeshPhysicalMaterial | null {
|
|
168
|
+
if (!(source instanceof THREE.MeshPhysicalMaterial) || !uniforms.has(source) || !materialDrawHooksSupported(source)) return null;
|
|
169
|
+
return graphShadow(source);
|
|
170
|
+
}
|
|
171
|
+
|
|
162
172
|
export function applyPhysicalMaterial(material: THREE.MeshPhysicalMaterial, input?: Physical,
|
|
163
173
|
clips: {map?: boolean; roughness?: boolean; normal?: boolean} = {}): void {
|
|
164
174
|
const data = input ?? defaults;
|