Packageorg.ffilmation.engine.core
Classpublic class fMaterialTypes

The fMaterialTypes class provides a list of all available material types in the engine, as well as examples of how to create them.



Public Constants
 ConstantDefined by
  CLIP : String = "clip"
[static]

Creates a material from a MovieClip or image exported in any SWF you import into the scene.

fMaterialTypes
  DOOR : String = "door"
[static]

Creates a door in any wall.

fMaterialTypes
  FENCE : String = "fence"
[static]

Creates a Fence material.

fMaterialTypes
  PERLIN : String = "perlin"
[static]

Creates a material by stacking several layers of "tile" materials, using a perlin noise funcion as alpha mask for each layer.

Perlin materials are procedural materials formed by a base material and unlimited layers of other materials, each one rendered from a perlin noise definition.

The perlin noise for each layer is used as the alpha-mask for that layer.

Both the base material and the layer materials must be "tile" materials and their definitions must be included for the perlin material to work.

With perlin materials, you can create more natural-looking environments without extra effort

fMaterialTypes
  PROCEDURAL : String = "procedural"
[static]

Creates a material using a custom class.

fMaterialTypes
  TILE : String = "tile"
[static]

Creates a material by "Tiling" an image in the imported libraries.

fMaterialTypes
  WINDOW : String = "window"
[static]

Adds windows to any wall.

fMaterialTypes
Constant detail
CLIPconstant
public static const CLIP:String = "clip"

Creates a material from a MovieClip or image exported in any SWF you import into the scene. The clip/image is scaled to fit the requested dimensions. If you want it to tile, use the fTileMaterial instead.

If you use a movieClip, place your "hole" definition clips only in the first frame. After reading the holes the class will gotoAndStop(2) the clip. In frame 2 you should have what you want to be visible as well as clips for doors and windows. See examples and tutorials for further info on holes, doors and windows


Example
Here's an example of how to define a material of type fMaterialTypes.CLIP
       <materialDefinition name="Ground" type="clip">
         <diffuse>Ground</diffuse>
         <bump>Ground_bump</bump>
       </materialDefinition>
       
diffuse: export name of the symbol to use as diffuse map, an image for "tile" materials and a movieClip for "clip" materials
bump: (optional) export name of the symbol to use as bumpmap. If none, this material is not bumpmapped

DOORconstant 
public static const DOOR:String = "door"

Creates a door in any wall. The Door material allows users to build doors fast.


Example
Here's an example of how to define a material of type fMaterialTypes.DOOR
       <materialDefinition name="MNIP_VillageMaterials_Door13" type="door">
           <base>FFMaterials_woods2_Wood2_13</base>
           <frame>FFMaterials_woods2_Wood2_11</frame>
           <door>FFMaterials_woods2_Wood2_14</door>
           <position>0</position>
           <width>90</width>
           <height>150</height>
           <framesize>10</framesize>
       </materialDefinition>   
       
base: Base "tile" material for the wall
frame: Frame material
door: Door material
position: Door position, as percent of wall size, from -100 to 100. The default 0 value centers the door in the wall
width: Door size, without frame
height: Door size, without frame
framesize: Frame size

FENCEconstant 
public static const FENCE:String = "fence"

Creates a Fence material. Keep in mind that holes have an impact in performace of the collision an light algorythms and therefore, this material has to be used with moderation.


Example
Here's an example of how to define a material of type fMaterialTypes.FENCE
       <materialDefinition name="MNIP_VillageMaterials_Fence" type="fence">
         <base>FFMaterials_woods1_Wood1_9</base>
         <width>20</width>
         <gap>10</gap>
         <irregular>20</irregular>
       </materialDefinition>   
       
base: Base "tile" material for the wall
width: Size of every post
gap: Space between posts
irregular: Between 0 and 100. Randomly alters height of every post to generate a more natural look

PERLINconstant 
public static const PERLIN:String = "perlin"

Creates a material by stacking several layers of "tile" materials, using a perlin noise funcion as alpha mask for each layer.

Perlin materials are procedural materials formed by a base material and unlimited layers of other materials, each one rendered from a perlin noise definition.

The perlin noise for each layer is used as the alpha-mask for that layer.

Both the base material and the layer materials must be "tile" materials and their definitions must be included for the perlin material to work.

With perlin materials, you can create more natural-looking environments without extra effort


Example
Here's an example of how to define a material of type fMaterialTypes.PERLIN
       <noiseDefinition name="Ground_noise_2">
         <seed>0</seed>     
         <baseX>200</baseX>
         <baseY>200</baseY>
         <octaves>2</octaves>
         <fractal>true</fractal>
       </noiseDefinition>
       
<materialDefinition name="MNIP_VillageMaterials_Ground" type="perlin"> <base>FFMaterials_ground_Ground1</base> <layer> <noise>Ground_noise_2</noise> <material>FFMaterials_ground_Ground7</material> </layer> </materialDefinition>
seed: The random seed number to use. If you keep all other parameters the same, you can generate different pseudo-random results by varying the random seed value. The Perlin noise function creates the same results each time from the same random seed. Use 0 if you want the engine to pick a random seed each time
baseX: Frequency to use in the x direction.
baseY: Frequency to use in the y direction.
octaves: Number of octaves or individual noise functions to combine to create this noise. Larger numbers of octaves create noise with greater detail. Larger numbers of octaves also require more processing time.
fractal: If the value is true, the method generates fractal noise; otherwise, it generates turbulence. An image with turbulence has visible discontinuities in the gradient that can make it better approximate sharper visual effects like flames and ocean waves.

PROCEDURALconstant 
public static const PROCEDURAL:String = "procedural"

Creates a material using a custom class. The class must implement the fEngineMaterial interface

See also


Example
Here's an example of how to define a material of type fMaterialTypes.PROCEDURAL
       <materialDefinition name="Ground" type="procedural">
          <classname>com.domain.game.materials.myMaterial</classname>
       </materialDefinition>
classname: class to be used. Make sure it is included when you compile your application

TILEconstant 
public static const TILE:String = "tile"

Creates a material by "Tiling" an image in the imported libraries.


Example
Here's an example of how to define a material of type fMaterialTypes.TILE
       <materialDefinition name="Ground" type="tile">
          <diffuse>Ground</diffuse>
          <bump>Ground_bump</bump>
       </materialDefinition>
diffuse: export name of the symbol to use as diffuse map, an image for "tile" materials and a movieClip for "clip" materials
bump: (optional) export name of the symbol to use as bumpmap. If none, this material is not bumpmapped

WINDOWconstant 
public static const WINDOW:String = "window"

Adds windows to any wall. This is a fast way of creating nicer buildings with little effort. Keep in mind that holes have an impact in performace of the collision an light algorythms and therefore, this material has to be used with moderation.


Example
Here's an example of how to define a material of type fMaterialTypes.WINDOW
       <materialDefinition name="MNIP_VillageMaterials_Windows13" type="window">
           <base>FFMaterials_woods2_Wood2_13</base>
           <frame>FFMaterials_woods2_Wood2_11</frame>
           <position>0</position>
           <width>60</width>
           <height>90</height>
           <framesize>5</framesize>
           <separation>80</separation>
           <geometry>2x2</geometry>
       </materialDefinition>   
       
base: Base "tile" material for the wall
frame: Frame material
position: Windows' vertical position, as percent of wall height, from -100 to 100.The default 0 value centers the windows vertically in the wall
width: Window size, without frame
height: Window size, without frame
framesize: Frame size
separation: Horizontal gap between windows. The engine will fit as many windows as possible depending on this value, the windows' width and the size of the plane where this material is applied
geometry: Window geometry, like 3x2 or 2x4. Its default value will draw one single window without subdivisions