Sfoglia il codice sorgente

make effect wrapper options its own interface

Trevor Baron 6 anni fa
parent
commit
287b556971
1 ha cambiato i file con 27 aggiunte e 1 eliminazioni
  1. 27 1
      src/Materials/effectRenderer.ts

+ 27 - 1
src/Materials/effectRenderer.ts

@@ -137,6 +137,32 @@ export class EffectRenderer {
 }
 
 /**
+ * Options to create an EffectWrapper
+ */
+interface EffectWrapperCreationOptions {
+    /**
+     * Engine to use to create the effect
+     */
+    engine: Engine;
+    /**
+     * Fragment shader for the effect
+     */
+    fragmentShader: string;
+    /**
+     * Attributes to use in the shader
+     */
+    attributeNames: Array<string>;
+    /**
+     * Uniforms to use in the shader
+     */
+    uniformNames: Array<string>;
+    /**
+     * Texture sampler names to use in the shader
+     */
+    samplerNames: Array<string>;
+}
+
+/**
  * Wraps an effect to be used for rendering
  */
 export class EffectWrapper {
@@ -153,7 +179,7 @@ export class EffectWrapper {
      * Creates an effect to be renderer
      * @param creationOptions options to create the effect
      */
-    constructor(creationOptions: {engine: Engine, fragmentShader: string, attributeNames: Array<string>, uniformNames: Array<string>, samplerNames: Array<string>}) {
+    constructor(creationOptions: EffectWrapperCreationOptions) {
         this.effect = new Effect({fragmentSource: creationOptions.fragmentShader, vertex: "postprocess"}, creationOptions.attributeNames, creationOptions.uniformNames, creationOptions.samplerNames, creationOptions.engine);
     }