@@ -37,13 +37,13 @@ const TypeCompatibility: Set<GraphDataType>[] = [
3737
3838export const canMapType = (
3939 fromType : GraphDataType | undefined ,
40- toType : GraphDataType | undefined
40+ toType : GraphDataType | undefined ,
4141) => {
4242 if ( fromType === toType || ! fromType || ! toType ) {
4343 return true ;
4444 }
4545 return TypeCompatibility . some (
46- ( compatibility ) => compatibility . has ( fromType ) && compatibility . has ( toType )
46+ ( compatibility ) => compatibility . has ( fromType ) && compatibility . has ( toType ) ,
4747 ) ;
4848} ;
4949
@@ -65,7 +65,7 @@ export const numberNode = (
6565 isRandom ?: boolean ;
6666 inputs ?: NodeInput [ ] ;
6767 outputs ?: NodeOutput [ ] ;
68- }
68+ } ,
6969) : NumberNode => ( {
7070 type : 'number' ,
7171 id,
@@ -95,7 +95,7 @@ export const numberUniformData = (
9595 name : string ,
9696 value : string ,
9797 range ?: [ string | number , string | number ] ,
98- stepper ?: string | number
98+ stepper ?: string | number ,
9999) : NumberDataUniform => ( {
100100 type : 'number' ,
101101 name,
@@ -124,7 +124,7 @@ export const textureNode = (
124124 id : string ,
125125 name : string ,
126126 position : NodePosition ,
127- value ?: TextureNodeValueData
127+ value ?: TextureNodeValueData ,
128128) : TextureNode => ( {
129129 type : 'texture' ,
130130 id,
@@ -149,24 +149,28 @@ export type TextureDataUniform = Pick<TextureNode, 'type' | 'value' | 'name'>;
149149
150150export const textureUniformData = (
151151 name : string ,
152- value : TextureNodeValueData
152+ value : TextureNodeValueData ,
153153) : TextureDataUniform => ( { type : 'texture' , name, value } ) ;
154154
155+ export type SamplerCubeNodeValueData = {
156+ assetId ?: number ;
157+ versionId ?: number ;
158+ } ;
159+
155160export interface SamplerCubeNode extends BaseNode {
156161 type : 'samplerCube' ;
157- value : string ;
162+ value ?: SamplerCubeNodeValueData ;
158163}
159164export const samplerCubeNode = (
160165 id : string ,
161166 name : string ,
162167 position : NodePosition ,
163- value : string
168+ value ?: SamplerCubeNodeValueData ,
164169) : SamplerCubeNode => ( {
165170 type : 'samplerCube' ,
166171 id,
167172 name,
168173 position,
169- value,
170174 inputs : [ ] ,
171175 outputs : [
172176 {
@@ -176,6 +180,7 @@ export const samplerCubeNode = (
176180 category : 'data' ,
177181 } ,
178182 ] ,
183+ value,
179184} ) ;
180185
181186export type SamplerCubeDataUniform = Pick <
@@ -185,8 +190,12 @@ export type SamplerCubeDataUniform = Pick<
185190
186191export const samplerCubeUniformData = (
187192 name : string ,
188- value : string
189- ) : SamplerCubeDataUniform => ( { type : 'samplerCube' , name, value } ) ;
193+ value : SamplerCubeNodeValueData ,
194+ ) : SamplerCubeDataUniform => ( {
195+ type : 'samplerCube' ,
196+ name,
197+ value,
198+ } ) ;
190199
191200export type ArrayValue = string [ ] ;
192201
@@ -200,7 +209,7 @@ export function arrayNode(
200209 id : string ,
201210 name : string ,
202211 position : NodePosition ,
203- value : ArrayValue
212+ value : ArrayValue ,
204213) : ArrayNode {
205214 return {
206215 id,
@@ -246,7 +255,7 @@ export function vectorNode(
246255 id : string ,
247256 name : string ,
248257 position : NodePosition ,
249- value : Vector2 | Vector3 | Vector4
258+ value : Vector2 | Vector3 | Vector4 ,
250259) : Vector2Node | Vector3Node | Vector4Node {
251260 const dataType =
252261 value . length === 2 ? 'vector2' : value . length === 3 ? 'vector3' : 'vector4' ;
@@ -267,8 +276,8 @@ export function vectorNode(
267276 ...( value . length === 2
268277 ? { value, dimensions : 2 , type : 'vector2' }
269278 : value . length === 3
270- ? { value, dimensions : 3 , type : 'vector3' }
271- : { value, dimensions : 4 , type : 'vector4' } ) ,
279+ ? { value, dimensions : 3 , type : 'vector3' }
280+ : { value, dimensions : 4 , type : 'vector4' } ) ,
272281 } ;
273282}
274283
@@ -279,7 +288,7 @@ export type ArrayDataUniform = Pick<
279288
280289export const arrayUniformData = (
281290 name : string ,
282- value : ArrayValue
291+ value : ArrayValue ,
283292) : ArrayDataUniform => ( {
284293 name,
285294 value,
@@ -302,14 +311,14 @@ export type Vector4DataUniform = Pick<
302311
303312export const vectorUniformData = (
304313 name : string ,
305- value : Vector2 | Vector3 | Vector4
314+ value : Vector2 | Vector3 | Vector4 ,
306315) : Vector2DataUniform | Vector3DataUniform | Vector4DataUniform => ( {
307316 name,
308317 ...( value . length === 2
309318 ? { value, dimensions : 2 , type : 'vector2' }
310319 : value . length === 3
311- ? { value, dimensions : 3 , type : 'vector3' }
312- : { value, dimensions : 4 , type : 'vector4' } ) ,
320+ ? { value, dimensions : 3 , type : 'vector3' }
321+ : { value, dimensions : 4 , type : 'vector4' } ) ,
313322} ) ;
314323
315324export interface RgbNode extends BaseNode {
@@ -327,7 +336,7 @@ export function colorNode(
327336 id : string ,
328337 name : string ,
329338 position : NodePosition ,
330- value : Vector3 | Vector4
339+ value : Vector3 | Vector4 ,
331340) : RgbNode | RgbaNode {
332341 const dataType = value . length === 3 ? 'rgb' : 'rgba' ;
333342 return {
@@ -360,7 +369,7 @@ export type RgbaDataUniform = Omit<
360369
361370export const colorUniformData = (
362371 name : string ,
363- value : Vector3 | Vector4
372+ value : Vector3 | Vector4 ,
364373) : RgbDataUniform | RgbaDataUniform => ( {
365374 name,
366375 ...( value . length === 3
0 commit comments