ソースを参照

resolve all comments

David `Deltakosh` Catuhe 5 年 前
コミット
ea42e495de

+ 1 - 1
dist/preview release/what's new.md

@@ -9,7 +9,7 @@
 - Reflection probes can now be used to give accurate shading with PBR ([CraigFeldpsar](https://github.com/craigfeldspar) and ([Sebavan](https://github.com/sebavan/)))
 - Reflection probes can now be used to give accurate shading with PBR ([CraigFeldpsar](https://github.com/craigfeldspar) and ([Sebavan](https://github.com/sebavan/)))
 - Added SubSurfaceScattering on PBR materials ([CraigFeldpsar](https://github.com/craigfeldspar) and ([Sebavan](https://github.com/sebavan/)))
 - Added SubSurfaceScattering on PBR materials ([CraigFeldpsar](https://github.com/craigfeldspar) and ([Sebavan](https://github.com/sebavan/)))
 - Added edition of PBR materials, Post processes and Particle fragment shaders in the node material editor ([Popov72](https://github.com/Popov72))
 - Added edition of PBR materials, Post processes and Particle fragment shaders in the node material editor ([Popov72](https://github.com/Popov72))
-- Added editiom of procedural texture in the node material editor ([Deltakosh](https://github.com/deltakosh))
+- Added edition of procedural texture in the node material editor ([Deltakosh](https://github.com/deltakosh))
 - Added Curve editor to manage entity's animations and edit animation groups in Inspector ([pixelspace](https://github.com/devpixelspace))
 - Added Curve editor to manage entity's animations and edit animation groups in Inspector ([pixelspace](https://github.com/devpixelspace))
 - Added support in `ShadowGenerator` for fast fake soft transparent shadows ([Popov72](https://github.com/Popov72))
 - Added support in `ShadowGenerator` for fast fake soft transparent shadows ([Popov72](https://github.com/Popov72))
 - Added support for **thin instances** for faster mesh instances. [Doc](https://doc.babylonjs.com/how_to/how_to_use_thininstances) ([Popov72](https://github.com/Popov72))
 - Added support for **thin instances** for faster mesh instances. [Doc](https://doc.babylonjs.com/how_to/how_to_use_thininstances) ([Popov72](https://github.com/Popov72))

+ 2 - 1
nodeEditor/src/components/nodeList/nodeListComponent.tsx

@@ -260,7 +260,8 @@ export class NodeListComponent extends React.Component<INodeListComponentProps,
                 break;
                 break;
             case NodeMaterialModes.ProceduralTexture:
             case NodeMaterialModes.ProceduralTexture:
                 delete allBlocks["Animation"];
                 delete allBlocks["Animation"];
-                delete allBlocks["Mesh"];                
+                delete allBlocks["Mesh"];  
+                delete allBlocks["Particle"];              
                 delete allBlocks["PostProcess"];
                 delete allBlocks["PostProcess"];
                 break;
                 break;
             case NodeMaterialModes.Particle:
             case NodeMaterialModes.Particle:

+ 13 - 11
src/Materials/Node/nodeMaterial.ts

@@ -818,11 +818,11 @@ export class NodeMaterial extends PushMaterial {
 
 
     /**
     /**
      * Create a new procedural texture based on this node material
      * Create a new procedural texture based on this node material
-     * @param size defines the size of the texture (which will be squared)
+     * @param size defines the size of the texture
      * @param scene defines the hosting scene
      * @param scene defines the hosting scene
      * @returns the new procedural texture attached to this node material
      * @returns the new procedural texture attached to this node material
      */
      */
-    public createProceduralTexture(size: number, scene: Scene): ProceduralTexture {
+    public createProceduralTexture(size: number | { width: number, height: number, layers?: number }, scene: Scene): ProceduralTexture {
         let tempName = this.name + this._buildId;
         let tempName = this.name + this._buildId;
 
 
         let proceduralTexture = new ProceduralTexture(tempName, size, null, scene);
         let proceduralTexture = new ProceduralTexture(tempName, size, null, scene);
@@ -868,13 +868,15 @@ export class NodeMaterial extends PushMaterial {
 
 
                 TimingTools.SetImmediate(() => {
                 TimingTools.SetImmediate(() => {
                     effect = this.getScene().getEngine().createEffect({
                     effect = this.getScene().getEngine().createEffect({
-                        vertexElement: tempName,
-                        fragmentElement: tempName
-                    },
-                    [VertexBuffer.PositionKind],
-                    this._fragmentCompilationState.uniforms,
-                    this._fragmentCompilationState.samplers,
-                    defines.toString(), result?.fallbacks, undefined);
+                            vertexElement: tempName,
+                            fragmentElement: tempName
+                        },
+                        [VertexBuffer.PositionKind],
+                        this._fragmentCompilationState.uniforms,
+                        this._fragmentCompilationState.samplers,
+                        defines.toString(), result?.fallbacks, undefined);
+
+                    proceduralTexture._effect = effect;
                 });
                 });
             }
             }
 
 
@@ -1406,7 +1408,7 @@ export class NodeMaterial extends PushMaterial {
     }
     }
 
 
     /**
     /**
-     * Clear the current material and set it to a default state for procedural texture
+     * Clear the current material and set it to a default state for post process
      */
      */
     public setToDefaultPostProcess() {
     public setToDefaultPostProcess() {
         this.clear();
         this.clear();
@@ -1456,7 +1458,7 @@ export class NodeMaterial extends PushMaterial {
     }
     }
 
 
     /**
     /**
-     * Clear the current material and set it to a default state for post process
+     * Clear the current material and set it to a default state for procedural texture
      */
      */
     public setToDefaultProceduralTexture() {
     public setToDefaultProceduralTexture() {
         this.clear();
         this.clear();

+ 5 - 10
src/Materials/Textures/Procedurals/proceduralTexture.ts

@@ -73,7 +73,7 @@ export class ProceduralTexture extends Texture {
     protected _fallbackTexture: Nullable<Texture>;
     protected _fallbackTexture: Nullable<Texture>;
 
 
     @serialize()
     @serialize()
-    private _size: number;
+    private _size: number | { width: number, height: number, layers?: number };
     private _currentRefreshId = -1;
     private _currentRefreshId = -1;
     private _frameId = -1;
     private _frameId = -1;
     private _refreshRate = 1;
     private _refreshRate = 1;
@@ -113,7 +113,7 @@ export class ProceduralTexture extends Texture {
      * @param generateMipMaps Define if the texture should creates mip maps or not
      * @param generateMipMaps Define if the texture should creates mip maps or not
      * @param isCube Define if the texture is a cube texture or not (this will render each faces of the cube)
      * @param isCube Define if the texture is a cube texture or not (this will render each faces of the cube)
      */
      */
-    constructor(name: string, size: any, fragment: any, scene: Nullable<Scene>, fallbackTexture: Nullable<Texture> = null, generateMipMaps = true, isCube = false) {
+    constructor(name: string, size: number | { width: number, height: number, layers?: number }, fragment: any, scene: Nullable<Scene>, fallbackTexture: Nullable<Texture> = null, generateMipMaps = true, isCube = false) {
         super(null, scene, !generateMipMaps);
         super(null, scene, !generateMipMaps);
 
 
         scene = this.getScene()!;
         scene = this.getScene()!;
@@ -136,7 +136,7 @@ export class ProceduralTexture extends Texture {
         this._fallbackTexture = fallbackTexture;
         this._fallbackTexture = fallbackTexture;
 
 
         if (isCube) {
         if (isCube) {
-            this._texture = this._fullEngine.createRenderTargetCubeTexture(size, { generateMipMaps: generateMipMaps, generateDepthBuffer: false, generateStencilBuffer: false });
+            this._texture = this._fullEngine.createRenderTargetCubeTexture(size as number, { generateMipMaps: generateMipMaps, generateDepthBuffer: false, generateStencilBuffer: false });
             this.setFloat("face", 0);
             this.setFloat("face", 0);
         }
         }
         else {
         else {
@@ -163,11 +163,6 @@ export class ProceduralTexture extends Texture {
         return this._effect;
         return this._effect;
     }
     }
 
 
-    /** @hidden */
-    public _setEffect(effect: Effect) {
-        this._effect = effect;
-    }
-
     /**
     /**
      * Gets texture content (Use this function wisely as reading from a texture can be slow)
      * Gets texture content (Use this function wisely as reading from a texture can be slow)
      * @returns an ArrayBufferView (Uint8Array or Float32Array)
      * @returns an ArrayBufferView (Uint8Array or Float32Array)
@@ -345,9 +340,9 @@ export class ProceduralTexture extends Texture {
 
 
     /**
     /**
      * Get the size the texture is rendering at.
      * Get the size the texture is rendering at.
-     * @returns the size (texture is always squared)
+     * @returns the size (on cube texture it is always squared)
      */
      */
-    public getRenderSize(): number {
+    public getRenderSize(): number | { width: number, height: number, layers?: number } {
         return this._size;
         return this._size;
     }
     }