rhodonite 0.16.0 → 0.16.1

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.
package/VERSION-FILE CHANGED
@@ -1,2 +1,2 @@
1
- v0.16.0-0-g07bc83a1c-dirty
1
+ v0.16.1-0-gf8994eb7f-dirty
2
2
  main
@@ -517,9 +517,11 @@ interface IVector {
517
517
  readonly x: number;
518
518
  readonly _v: TypedArray;
519
519
  readonly className: string;
520
+ readonly bytesPerComponent: number;
520
521
  readonly glslStrAsFloat: string;
521
522
  readonly glslStrAsInt: string;
522
- readonly bytesPerComponent: number;
523
+ readonly wgslStrAsFloat: string;
524
+ readonly wgslStrAsInt: string;
523
525
  toString(): string;
524
526
  toStringApproximately(): string;
525
527
  flattenAsArray(): Array<number>;
@@ -537,8 +539,6 @@ interface IVector {
537
539
  interface IMutableVector extends IVector {
538
540
  _v: TypedArray;
539
541
  readonly className: string;
540
- readonly glslStrAsFloat: string;
541
- readonly glslStrAsInt: string;
542
542
  raw(): TypedArray;
543
543
  setAt(i: number, value: number): IMutableVector;
544
544
  setComponents(...num: number[]): IMutableVector;
@@ -562,8 +562,6 @@ interface IMutableScalar extends IMutableVector {
562
562
  }
563
563
  interface IVector2 extends IVector {
564
564
  readonly className: string;
565
- readonly glslStrAsFloat: string;
566
- readonly glslStrAsInt: string;
567
565
  readonly x: number;
568
566
  readonly y: number;
569
567
  toString(): string;
@@ -581,8 +579,6 @@ interface IVector2 extends IVector {
581
579
  }
582
580
  interface IMutableVector2 extends IMutableVector {
583
581
  readonly className: string;
584
- readonly glslStrAsFloat: string;
585
- readonly glslStrAsInt: string;
586
582
  x: number;
587
583
  y: number;
588
584
  toString(): string;
@@ -613,8 +609,6 @@ interface IMutableVector2 extends IMutableVector {
613
609
  }
614
610
  interface IVector3 extends IVector {
615
611
  readonly className: string;
616
- readonly glslStrAsFloat: string;
617
- readonly glslStrAsInt: string;
618
612
  readonly x: number;
619
613
  readonly y: number;
620
614
  readonly z: number;
@@ -634,8 +628,6 @@ interface IVector3 extends IVector {
634
628
  }
635
629
  interface IMutableVector3 extends IMutableVector {
636
630
  readonly className: string;
637
- readonly glslStrAsFloat: string;
638
- readonly glslStrAsInt: string;
639
631
  x: number;
640
632
  y: number;
641
633
  z: number;
@@ -670,8 +662,6 @@ interface IMutableVector3 extends IMutableVector {
670
662
  }
671
663
  interface IVector4 extends IVector {
672
664
  readonly className: string;
673
- readonly glslStrAsFloat: string;
674
- readonly glslStrAsInt: string;
675
665
  readonly x: number;
676
666
  readonly y: number;
677
667
  readonly z: number;
@@ -691,8 +681,6 @@ interface IVector4 extends IVector {
691
681
  }
692
682
  interface IMutableVector4 extends IMutableVector {
693
683
  readonly className: string;
694
- readonly glslStrAsFloat: string;
695
- readonly glslStrAsInt: string;
696
684
  x: number;
697
685
  y: number;
698
686
  z: number;
@@ -761,6 +749,8 @@ declare abstract class AbstractVector implements IVector {
761
749
  get x(): number;
762
750
  get glslStrAsFloat(): string;
763
751
  get glslStrAsInt(): string;
752
+ get wgslStrAsFloat(): string;
753
+ get wgslStrAsInt(): string;
764
754
  isEqual(vec: IVector, delta?: number): boolean;
765
755
  isStrictEqual(vec: IVector): boolean;
766
756
  length(): number;
@@ -791,6 +781,8 @@ declare class Vector3_<T extends FloatTypedArrayConstructor> extends AbstractVec
791
781
  get w(): number;
792
782
  get glslStrAsFloat(): string;
793
783
  get glslStrAsInt(): string;
784
+ get wgslStrAsFloat(): string;
785
+ get wgslStrAsInt(): string;
794
786
  static get compositionType(): {
795
787
  readonly __numberOfComponents: number;
796
788
  readonly __glslStr: string;
@@ -1336,6 +1328,8 @@ declare class Vector4_<T extends FloatTypedArrayConstructor> extends AbstractVec
1336
1328
  get w(): number;
1337
1329
  get glslStrAsFloat(): string;
1338
1330
  get glslStrAsInt(): string;
1331
+ get wgslStrAsFloat(): string;
1332
+ get wgslStrAsInt(): string;
1339
1333
  static _fromCopyArray4(array: Array4<number>, type: FloatTypedArrayConstructor): Vector4_<FloatTypedArrayConstructor>;
1340
1334
  static _fromCopy4(x: number, y: number, z: number, w: number, type: FloatTypedArrayConstructor): Vector4_<FloatTypedArrayConstructor>;
1341
1335
  static _fromCopyArray(array: Array<number>, type: FloatTypedArrayConstructor): Vector4_<FloatTypedArrayConstructor>;
@@ -2794,6 +2788,8 @@ declare class Vector2_<T extends FloatTypedArrayConstructor> extends AbstractVec
2794
2788
  get y(): number;
2795
2789
  get glslStrAsFloat(): string;
2796
2790
  get glslStrAsInt(): string;
2791
+ get wgslStrAsFloat(): string;
2792
+ get wgslStrAsInt(): string;
2797
2793
  static get compositionType(): {
2798
2794
  readonly __numberOfComponents: number;
2799
2795
  readonly __glslStr: string;
@@ -3198,6 +3194,10 @@ declare class Matrix33 extends AbstractMatrix implements IMatrix, IMatrix33 {
3198
3194
  get m12(): number;
3199
3195
  get m22(): number;
3200
3196
  get className(): string;
3197
+ get glslStrAsFloat(): string;
3198
+ get glslStrAsInt(): string;
3199
+ get wgslStrAsFloat(): string;
3200
+ get wgslStrAsInt(): string;
3201
3201
  static get compositionType(): {
3202
3202
  readonly __numberOfComponents: number;
3203
3203
  readonly __glslStr: string;
@@ -5480,6 +5480,7 @@ declare abstract class AbstractMaterialContent extends RnObject {
5480
5480
  private static __pixelShaderityObjectMap;
5481
5481
  private static __reflectedShaderSemanticsInfoArrayMap;
5482
5482
  shaderType: ShaderTypeEnum;
5483
+ private __materialSemanticsVariantName;
5483
5484
  constructor(materialName: string, { isMorphing, isSkinning, isLighting }?: {
5484
5485
  isMorphing?: boolean | undefined;
5485
5486
  isSkinning?: boolean | undefined;
@@ -5487,6 +5488,7 @@ declare abstract class AbstractMaterialContent extends RnObject {
5487
5488
  }, vertexShaderityObject?: ShaderityObject, pixelShaderityObject?: ShaderityObject);
5488
5489
  protected setVertexShaderityObject(vertexShaderityObject?: ShaderityObject): void;
5489
5490
  protected setPixelShaderityObject(pixelShaderityObject?: ShaderityObject): void;
5491
+ makeMaterialSemanticsVariantName(): void;
5490
5492
  getMaterialSemanticsVariantName(): string;
5491
5493
  get vertexShaderityObject(): ShaderityObject | undefined;
5492
5494
  get pixelShaderityObject(): ShaderityObject | undefined;
@@ -9515,6 +9517,10 @@ declare class Matrix44 extends AbstractMatrix implements IMatrix, IMatrix44 {
9515
9517
  toString(): string;
9516
9518
  toJSON(): number;
9517
9519
  };
9520
+ get glslStrAsFloat(): string;
9521
+ get glslStrAsInt(): string;
9522
+ get wgslStrAsFloat(): string;
9523
+ get wgslStrAsInt(): string;
9518
9524
  /**
9519
9525
  * zero matrix(static version)
9520
9526
  */
@@ -10790,12 +10796,11 @@ declare function createMToon1Material({ additionalName, isMorphing, isSkinning,
10790
10796
  maxInstancesNumber?: Count;
10791
10797
  makeOutputSrgb?: boolean;
10792
10798
  }): Material;
10793
- declare function reuseOrRecreateCustomMaterial(currentMaterial: Material, vertexShaderStr: string, pixelShaderStr: string, { additionalName, isSkinning, isLighting, isMorphing, maxInstancesNumber, }?: {
10794
- additionalName?: string | undefined;
10799
+ declare function reuseOrRecreateCustomMaterial(currentMaterial: Material, vertexShaderStr: string, pixelShaderStr: string, { maxInstancesNumber, isSkinning, isLighting, isMorphing, }?: {
10800
+ maxInstancesNumber?: number | undefined;
10795
10801
  isSkinning?: boolean | undefined;
10796
10802
  isLighting?: boolean | undefined;
10797
10803
  isMorphing?: boolean | undefined;
10798
- maxInstancesNumber?: number | undefined;
10799
10804
  }): Material;
10800
10805
  declare function changeMaterial(entity: IMeshRendererEntityMethods, primitive: Primitive, material: Material): void;
10801
10806
  declare const MaterialHelper: Readonly<{
@@ -11147,7 +11152,7 @@ declare function computeGaussianDistributionRatioWhoseSumIsOne({ kernelSize, var
11147
11152
  declare const MathUtil: Readonly<{
11148
11153
  radianToDegree: typeof radianToDegree;
11149
11154
  degreeToRadian: typeof degreeToRadian;
11150
- toHalfFloat: () => (val: number) => number;
11155
+ toHalfFloat: () => ((val: number) => number);
11151
11156
  isPowerOfTwo: typeof isPowerOfTwo;
11152
11157
  isPowerOfTwoTexture: typeof isPowerOfTwoTexture;
11153
11158
  packNormalizedVec4ToVec2: typeof packNormalizedVec4ToVec2;
@@ -11430,6 +11435,8 @@ declare class Scalar_<T extends TypedArrayConstructor> extends AbstractVector {
11430
11435
  isEqual(scalar: Scalar_<T>, delta?: number): boolean;
11431
11436
  get glslStrAsFloat(): string;
11432
11437
  get glslStrAsInt(): string;
11438
+ get wgslStrAsFloat(): string;
11439
+ get wgslStrAsInt(): string;
11433
11440
  static _fromCopyNumber(value: number, type: FloatTypedArrayConstructor): Scalar_<FloatTypedArrayConstructor>;
11434
11441
  static _dummy(type: FloatTypedArrayConstructor): Scalar_<FloatTypedArrayConstructor>;
11435
11442
  static get compositionType(): {
@@ -14010,7 +14017,9 @@ declare const addLineNumberToCode: (shaderString: string) => string;
14010
14017
  declare function assertExist<T>(val: T): asserts val is NonNullable<T>;
14011
14018
  declare function deepCopyUsingJsonStringify(obj: {
14012
14019
  [k: string]: any;
14013
- }): any;
14020
+ }): {
14021
+ [k: string]: any;
14022
+ };
14014
14023
  declare function downloadArrayBuffer(fileNameToDownload: string, arrayBuffer: ArrayBuffer): void;
14015
14024
  declare function downloadTypedArray(fileNameToDownload: string, typedArray: TypedArray): void;
14016
14025
  declare const MiscUtil: Readonly<{
@@ -14020,7 +14029,7 @@ declare const MiscUtil: Readonly<{
14020
14029
  isSafari: () => boolean;
14021
14030
  preventDefaultForDesktopOnly: (e: Event) => void;
14022
14031
  isObject: (o: any) => boolean;
14023
- fillTemplate: (templateString: string, templateVars: string) => any;
14032
+ fillTemplate: (templateString: string, templateVars: string) => string;
14024
14033
  isNode: () => boolean;
14025
14034
  concatArrayBuffers: (segments: ArrayBuffer[], sizes: Byte$1[], offsets: Byte$1[], finalSize?: Byte$1) => ArrayBufferLike;
14026
14035
  concatArrayBuffers2: ({ finalSize, srcs, srcsOffset, srcsCopySize, }: {
@@ -14028,7 +14037,7 @@ declare const MiscUtil: Readonly<{
14028
14037
  srcs: ArrayBuffer[];
14029
14038
  srcsOffset: Byte$1[];
14030
14039
  srcsCopySize: Byte$1[];
14031
- }) => ArrayBufferLike;
14040
+ }) => ArrayBuffer;
14032
14041
  addLineNumberToCode: (shaderString: string) => string;
14033
14042
  downloadArrayBuffer: typeof downloadArrayBuffer;
14034
14043
  downloadTypedArray: typeof downloadTypedArray;
@@ -15916,11 +15925,13 @@ declare class VrmaImporter {
15916
15925
  static readHumanoid(rnm: RnM2Vrma): void;
15917
15926
  }
15918
15927
 
15919
- declare class Socket<Name extends string, N extends CompositionTypeEnum, T extends ComponentTypeEnum> {
15928
+ type SocketDefaultValue = Vector4 | Vector3 | Vector2 | Scalar$1 | Matrix44 | Matrix33;
15929
+ declare class Socket<Name extends string, N extends CompositionTypeEnum, T extends ComponentTypeEnum, V extends SocketDefaultValue> {
15920
15930
  readonly name: Name;
15921
15931
  readonly compositionType: N;
15922
15932
  readonly componentType: T;
15923
- constructor(name: Name, compositionType: N, componentType: T);
15933
+ readonly defaultValue?: V | undefined;
15934
+ constructor(name: Name, compositionType: N, componentType: T, defaultValue?: V | undefined);
15924
15935
  }
15925
15936
 
15926
15937
  declare abstract class CommonShaderPart {
@@ -15933,8 +15944,8 @@ declare abstract class CommonShaderPart {
15933
15944
  private static __makeVaryingVariablesWGSL;
15934
15945
  static getPixelPrerequisites(shaderNodes: AbstractShaderNode[]): string;
15935
15946
  static getMainPrerequisites(): string;
15936
- static getAssignmentStatement(varName: string, inputSocket: Socket<string, CompositionTypeEnum, ComponentTypeEnum>): string;
15937
- static getAssignmentVaryingStatementInPixelShader(varName: string, inputSocket: Socket<string, CompositionTypeEnum, ComponentTypeEnum>, inputNode: AbstractShaderNode): string;
15947
+ static getAssignmentStatement(varName: string, inputSocket: Socket<string, CompositionTypeEnum, ComponentTypeEnum, SocketDefaultValue>): string;
15948
+ static getAssignmentVaryingStatementInPixelShader(varName: string, inputSocket: Socket<string, CompositionTypeEnum, ComponentTypeEnum, SocketDefaultValue>, inputNode: AbstractShaderNode): string;
15938
15949
  static getAssignmentVaryingStatementInVertexShader(inputNode: AbstractShaderNode, varNames: string[], j: number): string;
15939
15950
  abstract get attributeNames(): AttributeNames;
15940
15951
  abstract get attributeSemantics(): Array<VertexAttributeEnum>;
@@ -15963,8 +15974,8 @@ type ShaderStage = 'Neutral' | 'Vertex' | 'Fragment';
15963
15974
  declare abstract class AbstractShaderNode extends RnObject {
15964
15975
  static _shaderNodes: AbstractShaderNode[];
15965
15976
  protected __shaderFunctionName: string;
15966
- protected __inputs: Socket<string, CompositionTypeEnum, ComponentTypeEnum>[];
15967
- protected __outputs: Socket<string, CompositionTypeEnum, ComponentTypeEnum>[];
15977
+ protected __inputs: Socket<string, CompositionTypeEnum, ComponentTypeEnum, SocketDefaultValue>[];
15978
+ protected __outputs: Socket<string, CompositionTypeEnum, ComponentTypeEnum, SocketDefaultValue>[];
15968
15979
  protected __inputConnections: ShaderNodeInputConnectionType[];
15969
15980
  private static __invalidShaderNodeCount;
15970
15981
  protected __shaderNodeUid: ShaderNodeUID;
@@ -15986,15 +15997,15 @@ declare abstract class AbstractShaderNode extends RnObject {
15986
15997
  * @param outputSocketOfInput- the output socket of the inputShaderNode.
15987
15998
  * @param inputSocketOfThis - the input socket of this node.
15988
15999
  */
15989
- addInputConnection<N extends CompositionTypeEnum, T extends ComponentTypeEnum>(inputShaderNode: AbstractShaderNode, outputSocketOfInput: Socket<string, N, T>, inputSocketOfThis: Socket<string, N, T>): void;
16000
+ addInputConnection<N extends CompositionTypeEnum, T extends ComponentTypeEnum>(inputShaderNode: AbstractShaderNode, outputSocketOfInput: Socket<string, N, T, SocketDefaultValue>, inputSocketOfThis: Socket<string, N, T, SocketDefaultValue>): void;
15990
16001
  get shaderFunctionName(): string;
15991
16002
  getShaderFunctionNameDerivative(): string;
15992
16003
  getShaderCode(shaderStage: ShaderTypeEnum): string;
15993
16004
  get shaderNodeUid(): ShaderNodeUID;
15994
- getInput(name: string): Socket<string, CompositionTypeEnum, ComponentTypeEnum> | undefined;
15995
- getInputs(): Socket<string, CompositionTypeEnum, ComponentTypeEnum>[];
15996
- getOutput(name: string): Socket<string, CompositionTypeEnum, ComponentTypeEnum> | undefined;
15997
- getOutputs(): Socket<string, CompositionTypeEnum, ComponentTypeEnum>[];
16005
+ getInput(name: string): Socket<string, CompositionTypeEnum, ComponentTypeEnum, SocketDefaultValue> | undefined;
16006
+ getInputs(): Socket<string, CompositionTypeEnum, ComponentTypeEnum, SocketDefaultValue>[];
16007
+ getOutput(name: string): Socket<string, CompositionTypeEnum, ComponentTypeEnum, SocketDefaultValue> | undefined;
16008
+ getOutputs(): Socket<string, CompositionTypeEnum, ComponentTypeEnum, SocketDefaultValue>[];
15998
16009
  get inputConnections(): ShaderNodeInputConnectionType[];
15999
16010
  makeCallStatement(i: number, shaderNode: AbstractShaderNode, functionName: string, varInputNames: string[][], varOutputNames: string[][]): string;
16000
16011
  }
@@ -16078,7 +16089,7 @@ declare class ShaderGraphResolver {
16078
16089
  /**
16079
16090
  * Construct shader code with shader nodes.
16080
16091
  *
16081
- * @param shaderNodes - Shader nodes
16092
+ * @param shaderNodes - Shader nodes (sorted topologically)
16082
16093
  * @param isVertexStage - Whether the shader is a vertex shader
16083
16094
  * @param isFullVersion - Whether to generate a full version of the shader code
16084
16095
  * @returns Shader code
@@ -16157,9 +16168,10 @@ declare const DefaultTextures: {
16157
16168
 
16158
16169
  declare class AddShaderNode extends AbstractShaderNode {
16159
16170
  constructor(compositionType: CompositionTypeEnum, componentType: ComponentTypeEnum);
16160
- getSocketInputLhs(): Socket<string, CompositionTypeEnum, ComponentTypeEnum>;
16161
- getSocketInputRhs(): Socket<string, CompositionTypeEnum, ComponentTypeEnum>;
16162
- getSocketOutput(): Socket<string, CompositionTypeEnum, ComponentTypeEnum>;
16171
+ getDefaultValue(compositionType: CompositionTypeEnum): Vector3 | Vector4 | Vector2 | Scalar$1;
16172
+ getSocketInputLhs(): Socket<string, CompositionTypeEnum, ComponentTypeEnum, SocketDefaultValue>;
16173
+ getSocketInputRhs(): Socket<string, CompositionTypeEnum, ComponentTypeEnum, SocketDefaultValue>;
16174
+ getSocketOutput(): Socket<string, CompositionTypeEnum, ComponentTypeEnum, SocketDefaultValue>;
16163
16175
  getShaderFunctionNameDerivative(): string;
16164
16176
  }
16165
16177
 
@@ -16173,7 +16185,7 @@ declare class AttributeNormalShaderNode extends AbstractShaderNode {
16173
16185
 
16174
16186
  declare class AttributePositionShaderNode extends AbstractShaderNode {
16175
16187
  constructor();
16176
- getSocketOutput(): Socket<string, CompositionTypeEnum, ComponentTypeEnum>;
16188
+ getSocketOutput(): Socket<string, CompositionTypeEnum, ComponentTypeEnum, SocketDefaultValue>;
16177
16189
  }
16178
16190
 
16179
16191
  declare class AttributeTexcoordShaderNode extends AbstractShaderNode {
@@ -16195,7 +16207,7 @@ declare class BlockEndShaderNode extends AbstractShaderNode {
16195
16207
  declare abstract class ConstantVariableShaderNode<N extends CompositionTypeEnum, T extends ComponentTypeEnum> extends AbstractShaderNode {
16196
16208
  constructor(nodeName: string, compositionType: N, componentType: T);
16197
16209
  setDefaultInputValue(value: IVector): void;
16198
- getSocketOutput(): Socket<string, CompositionTypeEnum, ComponentTypeEnum>;
16210
+ getSocketOutput(): Socket<string, CompositionTypeEnum, ComponentTypeEnum, SocketDefaultValue>;
16199
16211
  }
16200
16212
 
16201
16213
  declare class ConstantScalarVariableShaderNode<T extends ComponentTypeEnum> extends ConstantVariableShaderNode<typeof CompositionType.Scalar, T> {
@@ -16247,12 +16259,12 @@ declare class NormalizeShaderNode extends AbstractShaderNode {
16247
16259
 
16248
16260
  declare class OutColorShaderNode extends AbstractShaderNode {
16249
16261
  constructor();
16250
- getSocketInput(): Socket<string, CompositionTypeEnum, ComponentTypeEnum>;
16262
+ getSocketInput(): Socket<string, CompositionTypeEnum, ComponentTypeEnum, SocketDefaultValue>;
16251
16263
  }
16252
16264
 
16253
16265
  declare class OutPositionShaderNode extends AbstractShaderNode {
16254
16266
  constructor();
16255
- getSocketInput(): Socket<string, CompositionTypeEnum, ComponentTypeEnum>;
16267
+ getSocketInput(): Socket<string, CompositionTypeEnum, ComponentTypeEnum, SocketDefaultValue>;
16256
16268
  }
16257
16269
 
16258
16270
  declare class ProjectionMatrixShaderNode extends AbstractShaderNode {