Constructor

new(target:FlxSprite, ?material_:FoxMaterial, ?spritePixelSize:Float)

Variables

@:value(null)sprite:FlxSprite = null

@:value(0.01)pixelSize:Float = 0.01

@:value(false)flipX:Bool = false

@:value(false)flipY:Bool = false

@:value(false)useColorTransform:Bool = false

If enabled, the 3D sprite will adopt the color tint and color offsets

Note: This alters the material parameters

private@:value("null")__prevFrame:String = "null"

private__prevRect:FlxRect

private@:value(null)__prevBitmap:BitmapData = null

private@:value(true)__recalculateBounds:Bool = true

private@:value(new FlxMatrix())_matrix:FlxMatrix = new FlxMatrix()

A matrix that's used to store flixel frame offsets (if present)

@:value(TypedArray.Float32Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]))verticesRaw:Float32Array = TypedArray.Float32Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])

@:value(TypedArray.Float32Array([0, 0, 1, 0, 1, 1, 0, 1]))uvsRaw:Float32Array = TypedArray.Float32Array([0, 0, 1, 0, 1, 1, 0, 1])

private@:value(false)__defaultUVs:Bool = false

Methods

inlinegetWidth():Float

inlinegetHeight():Float

privatecalculateOffsetMatrix():Void

inlinegetSpriteTexture():BitmapData

Returns the current, active texture of the sprite

This also works with frame multi-atlas

Inherited Variables

Defined by FoxModel

context:Context3D

frustumCulling:Bool

If enabled, this will perform frustum culling, meaning this object will disable its rendering when it's not visible by the camera. If you have many many objects on-screen that shouldn't be visible off-screen, keep this enabled

@:value(false)deactivateWhenCulled:Bool = false

If true, this object will not call update(). Keep in mind this will disable any logic you've put here if extending this class.

@:value(1)cullMargin:Float = 1

The scale for the meshes extents, increase this if your object gets culled too early

@:value(false)culled:Bool = false

This value is set per-camera at draw time, indicating if the model has been culled

To disable these calculations, set frustumCulling to disabled

@:value(0)curLod:Int = 0

The current level of detail for this mesh

Can be changed to swap LODs at runtime (if the meshes have any)

This has no effect if the meshes have no LODs

@:value(new BoundingBox())cacheBounds:BoundingBox = new BoundingBox()

Precalculated bounds for all meshes of this model

Updates when a mesh is added/removed

Note: Vertex data updated manually are not accounted for this, you'd have to rebuild the mesh bounds via fromExtents()

@:value(new Matrix3D())__prevTransform:Matrix3D = new Matrix3D()

This is the object's transform from a previous frame, used for motion vector calculations.

Having to calculate previous transforms on empty objects is a bit pointless, so that's why this is here.

@:value([0])groups:Array<Int> = [0]

The draw groups from a scene this object will be drawn on.

Used mainly to separate meshes in passes in an optimized manner.

Note: When changing this array manually, always set FoxRenderer.mustRebuildDrawGroups to true to ensure proper updating.

There are dedicated functions for this below:

  • addToDrawGroup(group)
  • removeFromDrawGroup(group)
  • setDrawGroupAt(i, group)

@:value([])meshes:Array<FoxMesh> = []

Meshes that will be rendered by this model, they inherit this model transform.

Note: When changing this array manually, always set FoxRenderer.mustRebuildDrawGroups to true to ensure proper updating.

There are dedicated functions for this below:

  • setMeshAt(i, mesh)
  • addMesh(mesh)
  • removeMesh(mesh)
  • removeMeshByIndex(mesh)

@:value(null)materialOverride:FoxMaterial = null

If set, this material will be applied to every mesh of this model when rendering.

@:value(null)materialOverlay:FoxMaterial = null

If set, this material will be applied over every mesh of this model.

This will draw the meshes again using this material.

@:value([])perMeshMaterialOverride:Array<FoxMaterial> = []

An array for each mesh which can have an overriden material.

Set it to its respective index to override it. Null to remove it.

@:value([])perMeshMaterialOverlay:Array<FoxMaterial> = []

An array for each mesh which can have an overlay material.

Set it to its respective index to override it. Null to remove it.

@:value(null)skin:FoxSkinData = null

The skin associated with this mesh, assigned when added to a FoxArmature

@:value(true)castShadows:Bool = true

Wheter or not cast shadows (rendering in the shadow pass)

@:value(false)castColoredShadows:Bool = false

If true, this model will cast colored shadows, useful for tinted transluscent objects (stained glass, liquids, fabric).

Requires castShadows to be true.

Note: This is not implemented yet.

Defined by FoxObject

parent:FoxObject

If set, will adapt parent transform. Make sure the parent has a higher priority so it updates in order

position:Vector3D

@:value(new Vector3D())rotation:Vector3D = new Vector3D()

@:value(new Vector3D(1, 1, 1))scale:Vector3D = new Vector3D(1, 1, 1)

x:Float

y:Float

z:Float

angleX:Float

angleY:Float

angleZ:Float

@:value(EulerOrder.ZYX)rotationOrder:EulerOrder = EulerOrder.ZYX

This controls the way this object is rotated (via rotation)

The rotation is applied per-axis sequentially, meaning the way one axis rotate can influence the next rotation.

By default, the Z axis rotates first, this makes the object roll.

Then the Y axis is rotated next, this orients the rolled object horizontally, think of it as a swiveling floor fan.

And last, the X axis is rotated, this has the effect of tilting the Y rotation.

This is done in this order so there is no gimbal-lock when converting euler angles from quaternions. However, this order affects camera rotations.

Custom camera controllers should use ZXY order instead so no tilting occurs.

@:value(new Matrix3D())transform:Matrix3D = new Matrix3D()

This is the global transform for this Object, it encodes position, rotation and scale in a 4x4 matrix

@:value(new Vector3D())read onlyglobalPosition:Vector3D = new Vector3D()

@:value(new Vector3D())read onlyglobalRotation:Vector3D = new Vector3D()

@:value(new Vector3D())read onlyglobalScale:Vector3D = new Vector3D()

Defined by FoxBasic

@:value("FoxBasic")name:String = "FoxBasic"

@:value(true)visible:Bool = true

@:value(true)active:Bool = true

@:value(null)scene:FoxScene = null

@:value(false)__destroyed:Bool = false

animation:FoxAnimationPlayer

An animation controller for this basic. Although properties have to be manually linked, this is intended to be a general-purpose animator for this object

Inherited Methods

Defined by FoxModel

privateset_groups(v:Array<Int>):Array<Int>

privateset_meshes(v:Array<FoxMesh>):Array<FoxMesh>

renderMesh(mesh:FoxMesh, shader:FoxShader):Void

inlineaddMesh(mesh:FoxMesh):Void

inlinesetMeshAt(index:Int, mesh:FoxMesh):Void

inlineremoveMesh(mesh:FoxMesh):Void

inlineremoveMeshByIndex(index:Int):Void

inlineaddToDrawGroup(group:Int):Void

inlineremoveFromDrawGroup(group:Int):Void

inlinesetDrawGroupAt(index:Int, group:Int):Void

getMaterial(meshIdx:Int):FoxMaterial

Shortcut to get a material from a mesh by index

setMaterial(meshIdx:Int, mat:FoxMaterial):Void

Shortcut to assign a material to a mesh by index

getMeshMaterialOverride(meshIdx:Int):FoxMaterial

Shortcut to get an overriden material from a mesh by index

setMeshMaterialOverride(meshIdx:Int, mat:FoxMaterial):Void

Shortcut to assign an overriden material from a mesh by index

getMeshMaterialOverlay(meshIdx:Int):FoxMaterial

Shortcut to get an overriden material from a mesh by index

setMeshMaterialOverlay(meshIdx:Int, mat:FoxMaterial):Void

Shortcut to assign an overriden material from a mesh by index

loadJSON(name:String):Null<{meshes:Array<FoxMesh>, materials:Map<String, FoxMaterial>}>

Loads a FoxLite JSON model

loadOBJ(name:String, ?extraShaderFlags:Array<String>, ?customShaderPath:String):Null<{meshes:Array<FoxMesh>, materials:Map<String, FoxMaterial>}>

computeBounds(output:BoundingBox):Void

Gets the expanded combined bounding box of all meshes inside this model

Parameters:

output

the Bounding Box where to store the result

testAndCull(camera:FoxCamera):Void

Performs frustum culling by checking the sorrounding bounding box against a camera frustum

Defined by FoxObject

@:value({ z : 0, y : 0, x : 0 })setPosition(x:Float = 0, y:Float = 0, z:Float = 0):Void

@:value({ z : 0, y : 0, x : 0 })setRotation(x:Float = 0, y:Float = 0, z:Float = 0):Void

@:value({ z : 0, y : 0, x : 0 })setAngle(x:Float = 0, y:Float = 0, z:Float = 0):Void

Same as setRotation() but for angle degrees.

setAngleFromVector(angles:Vector3D):Void

Sets the object's angle degrees from a Vector3D

getAngle(?output:Vector3D):Vector3D

Gets the object's rotation as degrees, as a Vector3D

Parameters:

output

(Optional) the output vector to store the angles without allocating a new one

Returns:

a Vector3D containing angleX, angleY and angleZ

@:value({ w : 1, z : 0, y : 0, x : 0 })setRotationQuaternion(x:Float = 0, y:Float = 0, z:Float = 0, w:Float = 1):Vector3D

Sets the object's rotation from a Quaternion, which is needed for accurate rotation representation when interpolating.

How dows it work? hell if i know

setRotationQuaternionFromVector(quat:Vector3D):Vector3D

@:value({ z : 1, y : 1, x : 1 })setScale(x:Float = 1, y:Float = 1, z:Float = 1):Void

copyComponentsFrom(object:FoxObject):Void

Copies position, rotation and scale from another FoxObject, so the other object's components doesn't affect this one when changing them

privateget_globalPosition():Vector3D

privateget_globalRotation():Vector3D

privateget_globalScale():Vector3D

privateget_x():Float

privateget_y():Float

privateget_z():Float

privateinlineset_x(v:Float):Float

privateinlineset_y(v:Float):Float

privateinlineset_z(v:Float):Float

privateset_angleX(v:Float):Float

privateset_angleY(v:Float):Float

privateset_angleZ(v:Float):Float

privateget_angleX():Float

privateget_angleY():Float

privateget_angleZ():Float

Defined by FoxBasic

physicsUpdate(dt:Float):Void

Called when a physics frame occurs, this is a constant update regardless of framerate for a consistant physics simulation.