Here is an export plugin for Fast3D at source level.
Debug mode is enabled
ver 20200625 (Beta)
Features:
- Duplicate Vertex removal
- Triangle Sorting
- Flat Shading
- Smooth Shading (Lighting only, An8 does not support Vertex Shading)
- Lighting
- Fog (Disables Vertex Alpha as N64 places Distance on Vertex Alpha)
- Texture Mapping
- Environment Mapping
- Bounding Box
Bounding Volume Radius - Nothing Output Yet - Binary Seperating Plane (Partial Support with Tree traversal)
- Groups and full hiearchy. Usefull for animation or part culling. [/color]
Supports:
- Fast3D (16 vertex cache)(Default)
- 4Tri (GE/PD Fast3D Extension)
- F3DEX (32 Vertex Cache, 2Triangles)
- F3DEX2 (32 Vertex Cache, 2Triangles)
WishList:
Portals (use mesh name "PortalA-B")
Animations - Translate/Rotate
Needs flag IsAnimate else Pre-Calc matrix
using $point = $transformMat.Project($point);
Attributes (Case in-sensitive):
uCode - Define EITHER a String Attribute with name "uCode" with:
OR
Define an Attribute of ANY type with name:
Fast3D (default)
F3DEX
F3DEX2
4 Triangles Extension - Define an Attribute of ANY type with name "TRI4_Ext"
Vertex Cache Override - Define an Integer with name "VtxCacheOvr" (Not Recomended)
Integer Vertices - Define a Boolean with name "IntVtx" (Default False)
Optimization Level - Define an Integer with name "Optimize"
0 None
1 Sort Triangles
2 Trim Duplicate Vertices (Default)
3 Trim Vertices Aggressive (Not Recomended)
Ignore ST and RGBA, Force Integer Vertices
Lighting - Define a Boolean with name "G_LIGHTING" (Default false)
Fog - Define a Boolean with name "G_FOG" (Default True)
Auto Sun (Static - Define a Point with name "AutoSun" (Default False)
Vertex Shading) X = Direction(0-360) (North = 0, East = 90 etc)
Y = Azimuth (0-90) where 0 is the Horizon
* Ortho View
* 90 Y+. Azimuth
* /|\
* .``|``
* ' |
* - |
* . |
* | S 180
* E 90 | /
* '-.|/`
* - /` ```--..
* . /` ``--.. .
* 0 . /` ``--:.`.
* ./` :----' X+ W 270
* |'-.`
* Z+ ````` N 0
Light direction is "Source" of light
eg: The sun is in the south (180) at 45 High
Result C attached as txt
H
/*
* Export object "object01"
*
* Do not edit this file. It was automatically generated
* with Anim8or 1.01 Build 1.01.1378+
* from File "test.an8"
* Using uCode Fast3D
*/
#define G_CC_PASS1 0, 0, 0, 0, 0, 0, 0, 0
#define G_CC_PRIMSHADE PRIMITIVE, 0, SHADE, 0, 0, 0, 0, 1
#define G_CC_PRIMSHADEA PRIMITIVE, 0, SHADE, 0, 0, 0, 0, SHADE
#define G_CC_PRIMSHADEFA PRIMITIVE, 0, SHADE, 0, 0, 0, 0, PRIMITIVE
#define G_CC_SHADE2 PRIMITIVE, 0, SHADE, 0, 0, 0, 0, 1
#define G_CC_SHADE2A PRIMITIVE, 0, SHADE, 0, 0, 0, 0, SHADE
#define G_CC_SHADE2FA PRIMITIVE, 0, SHADE, 0, 0, 0, 0, PRIMITIVE
#define G_CC_MODRGB COMBINED, 0, SHADE, 0, 0, 0, 0, 1
#define G_CC_MODRGBA COMBINED, 0, SHADE, 0, 0, 0, 0, SHADE
#define G_CC_MODRGBFA COMBINED, 0, SHADE, 0, 0, 0, 0, PRIMITIVE
#define LoadTextureBlock(ltbTextureName, ltbTextureImageFormat, ltbBitDepth, isDetail, width, \
height, pal, cms, cmt, masks, maskt, shifts, shiftt) \
\
gsDPSetTextureImage(ltbTextureImageFormat, ltbBitDepth##_LOAD_BLOCK, 1, ltbTextureName), \
gsDPSetTile(ltbTextureImageFormat, ltbBitDepth##_LOAD_BLOCK, 0, 0, G_TX_LOADTILE, \
0 , cmt, maskt, shiftt, cms, masks, shifts), \
gsDPLoadSync(), \
gsDPLoadBlock(G_TX_LOADTILE, 0, 0, \
(((width)*(height) + ltbBitDepth##_INCR) >> ltbBitDepth##_SHIFT)-1, \
CALC_DXT(width, ltbBitDepth##_BYTES)), \
gsDPPipeSync(), \
gsDPSetTile(ltbTextureImageFormat, ltbBitDepth, \
((((width) * ltbBitDepth##_LINE_BYTES)+7)>>3), 0, \
G_TX_RENDERTILE+isDetail, pal, cmt, maskt, shiftt, cms, masks, shifts), \
gsDPSetTileltbBitDepthe(G_TX_RENDERTILE+isDetail, 0, 0, \
((width)-1) << G_TEXTURE_IMAGE_FRAC, \
((height)-1) << G_TEXTURE_IMAGE_FRAC)
#define LoadMipMapTile(tmemoffset, rtile, ltbTextureImageFormat, ltbBitDepth, width, \
height, pal, cms, cmt, masks, maskt, shifts, shiftt) \
gsDPSetTile(ltbTextureImageFormat, ltbBitDepth, \
((((width) * ltbBitDepth##_LINE_BYTES)+7)>>3), tmemoffset, \
rtile, pal, cmt, maskt, shiftt, cms, masks, shifts), \
gsDPSetTileltbBitDepthe(rtile, 0, 0, \
((width)-1) << G_TEXTURE_IMAGE_FRAC, \
((height)-1) << G_TEXTURE_IMAGE_FRAC)
/* Define Textures */
/*
* Texture image format :
* G_IM_FMT_RGBA(RGBA format)
* G_IM_FMT_YUV (YUV format)
* G_IM_FMT_CI (CI format)
* G_IM_FMT_IA (IA format)
* G_IM_FMT_I (I format)
* Bit Depth :
* G_IM_SIZ_8b (8 bits / texel)
* G_IM_SIZ_16b (16 bits / texel)
* G_IM_SIZ_32b (32 bits / texel)
* S T Flags :
* G_TX_MIRROR (enable mirror operations)
* G_TX_NOMIRROR(disable mirror operations)
* G_TX_WRAP (enable wrap operations)
* G_TX_CLAMP (enable clamp operations)
*/
/* Assign the corect values for brickdetail4colour Including any Mip-Map Tiles at end. */
#define BRICKDETAIL4COLOUR_Width 32
#define BRICKDETAIL4COLOUR_Height 32
#define BRICKDETAIL4COLOUR_MaskS Log(BRICKDETAIL4COLOUR_Width) / Log(2)
#define BRICKDETAIL4COLOUR_MaskT Log(BRICKDETAIL4COLOUR_Height) / Log(2)
#define BRICKDETAIL4COLOUR_DL \
gsDPPipeSync(), \
LoadTextureBlock(&brickdetail4colour, \
G_IM_FMT_RGBA, G_IM_SIZ_32b, FALSE, /* Format, BitDepth, isDetail */ \
BRICKDETAIL4COLOUR_Width, BRICKDETAIL4COLOUR_Height, 0, /* Width, Height, PaletteID */ \
S Flags, T Flags, /* Clamp/Wrap/Mirror */ \
BRICKDETAIL4COLOUR_MaskS, BRICKDETAIL4COLOUR_MaskT, /* Pow 2 Bounds for flag, eg use 5 for a 32x32 texture (5^2=32) */\
ShiftS, ShiftT), /* Use G_TX_NOLOD */ \
LoadMipMapTile(0, 0, /* TMEM Offset, TileNumber */ \
G_IM_FMT_RGBA, G_IM_SIZ_32b, /* Format, BitDepth */ \
BRICKDETAIL4COLOUR_Width, BRICKDETAIL4COLOUR_Height, 0, /* Width, Height, PaletteID */ \
S Flags, T Flags, /* Clamp/Wrap/Mirror */ \
BRICKDETAIL4COLOUR_MaskS, BRICKDETAIL4COLOUR_MaskT, /* Pow 2 Bounds for flag, eg use 5 for a 32x32 texture (5^2=32) */\
ShiftS, ShiftT), /* Use G_TX_NOLOD */ \
/* (From here, do LoadMipMapTile for each subsequent tile, eg a 32x32 usually has 6 tiles (0-5)) */\
Trev
Edit 21:34, Added more draw commands
Edit 02:36, Added Triangle sorting, Auto Sun Baking, some other flags.
Edit 02:08, Added 4Tri and fixed VtxCache to batch by TnL changes and uCode limits (16/32 counts)
Edit 01:17, Added Tree traversal, Bounding boxes and named BSP support