Package 

Class Material


  • 
    public class Material
    
                        

    A Filament Material defines the visual appearance of an object. Materials function as a templates from which MaterialInstances can be spawned. Use Builder to construct a Material object.

    • Constructor Detail

      • Material

        Material(long nativeMaterial)
    • Method Detail

      • getName

         String getName()

        Returns the name of this material. The material name is used for debugging purposes.

      • isColorWriteEnabled

         boolean isColorWriteEnabled()

        Indicates whether instances of this material will, by default, write to the color buffer.

      • isDepthWriteEnabled

         boolean isDepthWriteEnabled()

        Indicates whether instances of this material will, by default, write to the depth buffer.

      • isDepthCullingEnabled

         boolean isDepthCullingEnabled()

        Indicates whether instances of this material will, by default, use depth testing.

      • isDoubleSided

         boolean isDoubleSided()

        Indicates whether this material is double-sided.

      • isAlphaToCoverageEnabled

         boolean isAlphaToCoverageEnabled()

        Indicates whether instances of this material will use alpha to coverage.

      • getMaskThreshold

         float getMaskThreshold()

        Returns the alpha mask threshold used when the blending mode is set to masked.

      • getSpecularAntiAliasingVariance

         float getSpecularAntiAliasingVariance()

        Returns the screen-space variance for specular-antialiasing. This value is between 0 and 1.

      • getSpecularAntiAliasingThreshold

         float getSpecularAntiAliasingThreshold()

        Returns the clamping threshold for specular-antialiasing. This value is between 0 and 1.

      • getParameterCount

         int getParameterCount()

        Returns the number of parameters declared by this material.The returned value can be 0.

      • getParameters

         List<Material.Parameter> getParameters()

        Returns a list of Parameter objects representing this material's parameters.The list may be empty if the material has no declared parameters.

      • hasParameter

         boolean hasParameter(@NonNull() String name)

        Indicates whether a parameter of the given name exists on this material.

      • setDefaultParameter

         void setDefaultParameter(@NonNull() String name, boolean x)

        Sets the value of a bool parameter on this material's default instance.

        Parameters:
        name - the name of the material parameter
        x - the value of the material parameter
      • setDefaultParameter

         void setDefaultParameter(@NonNull() String name, float x)

        Sets the value of a float parameter on this material's default instance.

        Parameters:
        name - the name of the material parameter
        x - the value of the material parameter
      • setDefaultParameter

         void setDefaultParameter(@NonNull() String name, int x)

        Sets the value of an int parameter on this material's default instance.

        Parameters:
        name - the name of the material parameter
        x - the value of the material parameter
      • setDefaultParameter

         void setDefaultParameter(@NonNull() String name, boolean x, boolean y)

        Sets the value of a bool2 parameter on this material's default instance.

        Parameters:
        name - the name of the material parameter
        x - the value of the first component
        y - the value of the second component
      • setDefaultParameter

         void setDefaultParameter(@NonNull() String name, float x, float y)

        Sets the value of a float2 parameter on this material's default instance.

        Parameters:
        name - the name of the material parameter
        x - the value of the first component
        y - the value of the second component
      • setDefaultParameter

         void setDefaultParameter(@NonNull() String name, int x, int y)

        Sets the value of an int2 parameter on this material's default instance.

        Parameters:
        name - the name of the material parameter
        x - the value of the first component
        y - the value of the second component
      • setDefaultParameter

         void setDefaultParameter(@NonNull() String name, boolean x, boolean y, boolean z)

        Sets the value of a bool3 parameter on this material's default instance.

        Parameters:
        name - the name of the material parameter
        x - the value of the first component
        y - the value of the second component
        z - the value of the third component
      • setDefaultParameter

         void setDefaultParameter(@NonNull() String name, float x, float y, float z)

        Sets the value of a float3 parameter on this material's default instance.

        Parameters:
        name - the name of the material parameter
        x - the value of the first component
        y - the value of the second component
        z - the value of the third component
      • setDefaultParameter

         void setDefaultParameter(@NonNull() String name, int x, int y, int z)

        Sets the value of a int3 parameter on this material's default instance.

        Parameters:
        name - the name of the material parameter
        x - the value of the first component
        y - the value of the second component
        z - the value of the third component
      • setDefaultParameter

         void setDefaultParameter(@NonNull() String name, boolean x, boolean y, boolean z, boolean w)

        Sets the value of a bool4 parameter on this material's default instance.

        Parameters:
        name - the name of the material parameter
        x - the value of the first component
        y - the value of the second component
        z - the value of the third component
        w - the value of the fourth component
      • setDefaultParameter

         void setDefaultParameter(@NonNull() String name, float x, float y, float z, float w)

        Sets the value of a float4 parameter on this material's default instance.

        Parameters:
        name - the name of the material parameter
        x - the value of the first component
        y - the value of the second component
        z - the value of the third component
        w - the value of the fourth component
      • setDefaultParameter

         void setDefaultParameter(@NonNull() String name, int x, int y, int z, int w)

        Sets the value of a int4 parameter on this material's default instance.

        Parameters:
        name - the name of the material parameter
        x - the value of the first component
        y - the value of the second component
        z - the value of the third component
        w - the value of the fourth component
      • setDefaultParameter

         void setDefaultParameter(@NonNull() String name, @NonNull() MaterialInstance.BooleanElement type, @NonNull() @Size(min = 1) Array<boolean> v, @IntRange(from = 0) int offset, @IntRange(from = 1) int count)

        Set a bool parameter array by name.

        Parameters:
        name - name of the parameter array as defined by this Material
        type - the number of components for each individual parameter
        v - array of values to set to the named parameter array
        offset - the number of elements in v to skip
        count - the number of elements in the parameter array to setFor example, to set a parameter array of 4 bool4s:
        {@code * boolean[] a = new boolean[4 * 4]; * material.setDefaultParameter("param", MaterialInstance.BooleanElement.BOOL4, a, 0, 4); * }
      • setDefaultParameter

         void setDefaultParameter(@NonNull() String name, @NonNull() MaterialInstance.IntElement type, @NonNull() @Size(min = 1) Array<int> v, @IntRange(from = 0) int offset, @IntRange(from = 1) int count)

        Set an int parameter array by name.

        Parameters:
        name - name of the parameter array as defined by this Material
        type - the number of components for each individual parameter
        v - array of values to set to the named parameter array
        offset - the number of elements in v to skip
        count - the number of elements in the parameter array to setFor example, to set a parameter array of 4 int4s:
        {@code * int[] a = new int[4 * 4]; * material.setDefaultParameter("param", MaterialInstance.IntElement.INT4, a, 0, 4); * }
      • setDefaultParameter

         void setDefaultParameter(@NonNull() String name, @NonNull() MaterialInstance.FloatElement type, @NonNull() @Size(min = 1) Array<float> v, @IntRange(from = 0) int offset, @IntRange(from = 1) int count)

        Set a float parameter array by name.

        Parameters:
        name - name of the parameter array as defined by this Material
        type - the number of components for each individual parameter
        v - array of values to set to the named parameter array
        offset - the number of elements in v to skip
        count - the number of elements in the parameter array to setFor example, to set a parameter array of 4 float4s:
        {@code * float[] a = new float[4 * 4]; * material.setDefaultParameter("param", MaterialInstance.FloatElement.FLOAT4, a, 0, 4); * }
      • setDefaultParameter

         void setDefaultParameter(@NonNull() String name, @NonNull() Colors.RgbType type, float r, float g, float b)

        Sets the color of the given parameter on this material's default instance.

        Parameters:
        name - the name of the material color parameter
        type - whether the color is specified in the linear or sRGB space
        r - red component
        g - green component
        b - blue component
      • setDefaultParameter

         void setDefaultParameter(@NonNull() String name, @NonNull() Colors.RgbaType type, float r, float g, float b, float a)

        Sets the color of the given parameter on this material's default instance.

        Parameters:
        name - the name of the material color parameter
        type - whether the color is specified in the linear or sRGB space
        r - red component
        g - green component
        b - blue component
        a - alpha component
      • setDefaultParameter

         void setDefaultParameter(@NonNull() String name, @NonNull() Texture texture, @NonNull() TextureSampler sampler)

        Sets a texture and sampler parameter on this material's default instance.

        Parameters:
        name - The name of the material texture parameter
        texture - The texture to set as parameter
        sampler - The sampler to be used with this texture