Static variables

@:value(0x69)static__GLOBAL_ID:Int = 0x69

Global ID to keep track of FoxMaterials, increments when a new one is created

Static methods

staticcreate(shader:FoxShader, ?textures:Map<String, FoxTexture>, ?params:Map<String, Dynamic>):FoxMaterial

staticinlinecreateCustom(shaderPath:String, ?shaderFlags:Array<String>, ?textures:Map<String, FoxTexture>, ?params:Map<String, Dynamic>):FoxMaterial

Short and more straightforward version of create()

staticinlinecreateBasic(?shaderFlags:Array<String>, ?textures:Map<String, FoxTexture>, ?params:Map<String, Dynamic>):FoxMaterial

Creates a material with foxlite's basic ubershader by default

staticinlinecreateMinimal(?shaderFlags:Array<String>, ?textures:Map<String, FoxTexture>, ?params:Map<String, Dynamic>):FoxMaterial

Creates a material with foxlite's minimal shader by default

The minimal shader handles very basic 3D rendering, and does not have any lights

staticinlinecreateSky(texture:FoxTexture):FoxMaterial

Creates a material with foxlite's sky shader by default

staticcreateSkyCustom(shaderPath:String, texture:FoxTexture, ?params:Map<String, Dynamic>):FoxMaterial

Creates a material with a custom sky shader, this also accepts custom shader parameters

@:value({ thickness : 1 })staticcreateLine(?shaderFlags:Array<String>, thickness:Float = 1):FoxMaterial

Creates a line material using foxlite's minimal shader

@:value({ thickness : 1 })staticcreateLineShaded(?shaderFlags:Array<String>, thickness:Float = 1):FoxMaterial

Creates a line material using foxlite's basic shader. This material can recieve lights and shadows, aswell as having reflections and custom vertex transforms

@:value({ thickness : 1 })staticcreateLineCustom(shaderPath:String, ?shaderFlags:Array<String>, thickness:Float = 1):FoxMaterial

Creates a line material using a custom shader

staticfromJSON(name:String):Any

Loads a material from a Foxlite's custom JSON format

Returns:

A Map containing material entries from the JSON, or a single FoxMaterial if specified with "path/to/mat:<material name>"

staticfromMTL(name:String):Any

Loads a material from a MTL file

Returns:

A Map containing material entries from the MTL, or a single FoxMaterial if specified with "path/to/mat:<material name>"

Constructor

new(?shader_:FoxShader)

Variables

private@:value(0)__id:Int = 0

Internal id for this material, do not change it

@:value("")__tid:String = ""

A sortable identifier for the BalancedTree draw list. Cached for speed, do not modify.

@:value(true)depthTest:Bool = true

@:value(FoxDepthCompareMode.LESS)depthFunc:FoxDepthCompareMode = FoxDepthCompareMode.LESS

@:value(true)depthWrite:Bool = true

@:value(true)colorWrite:Bool = true

@:value(FoxTriangleFace.NONE)culling:FoxTriangleFace = FoxTriangleFace.NONE

@:value(FoxTriangleFace.FRONT)shadowCulling:FoxTriangleFace = FoxTriangleFace.FRONT

@:value(FoxBlendMode.NONE)blendMode:FoxBlendMode = FoxBlendMode.NONE

@:value(0)alphaScissor:Float = 0

@:value(new StringMap())textures:Map<String, FoxTexture> = new StringMap()

@:value(new StringMap())params:Map<String, Dynamic> = new StringMap()

name:String

@:value(null)shader:FoxShader = null

assetsKey:String

environment:FoxEnvironment

A custom environment only for this material

@:value(0)renderPriority:Int = 0

This controls the rendering order of materials.

Lower priority means the model will be rendered before other models.

@:value(0x0004)renderMode:Int = 0x0004

The render mode of this material, switches between GL.TRIANGLES and GL.LINES.

To render models in wireframe mode, use the later.

@:value(1)lineWidth:Float = 1

Used when renderMode is GL.LINES

Methods

setColor(color:FlxColor):FoxMaterial

Sets the material tint color, acts like colorMultipliers

Returns:

the current material, useful for chaining calls, if you're into that

getColor():FlxColor

setEmissiveColor(emissive:FlxColor):FoxMaterial

Sets the material emissive color, this is the light emitted from the model, acts like colorOffsets

Returns:

the current material, useful for chaining calls, if you're into that

getEmissiveColor():FlxColor

@:value({ roughness : 0 })setRoughness(roughness:Float = 0):FoxMaterial

Sets the material roughness factor, this controls how blurry the reflections are

@:value({ metallic : 0 })setMetallic(metallic:Float = 0):FoxMaterial

Sets the material metallic factor, this controls how reflective it is

@:value({ scattering : 0 })setScattering(scattering:Float = 0):FoxMaterial

Sets the material subsurface-scattering factor, this controls how much light passes trough it

@:value({ blue : 0, green : 0, red : 0 })setSpecularLevels(red:Float = 0, green:Float = 0, blue:Float = 0):FoxMaterial

Sets the material specular levels, this controls how strongly light bounces off it. It can "reflect" a custom color

pushShaderUniforms(passShader:FoxShader):Void

Uploads uniform data to the shader when this material is active.

copy():FoxMaterial

Copies this material object, does not create new data on GPU

destroy():Void

privateset___id(v:Int):Int

privateset_renderPriority(v:Int):Int