L3DT development blog
Large 3D terrain generator

L3DT v2.9 build 11

Hi Everyone,

On the downloads pages you may now find L3DT v2.9 build 11, in both the Standard and Professional editions. This developmental update includes a couple of bugfixes and some new features, as outlined below.

Inverting normals in mesh files

A week or two ago, some users in a not-to-distant corner of the internets were discussing troubles with L3DT's mesh export files. Specifically, they found that L3DT was exporting 3DS and OBJ mesh files with inverted normals. Of course, this was because they were using a renderer that uses a left-handed coordinate system whereas L3DT uses a right-handed coordinate system. Fortunately, Google Alerts notified me of this dire situation, and I've modified all the mesh exporters to allow mesh normals to be flipped during export. This applies to the 3DS, OBJ, X and B3D mesh exporter plugins.

To make use of this option in L3DT v2.9 build 11, go to the 'File→Format preferences' menu option, and navigate to the 'Project maps→Heightfield' tree option. Then, select the mesh format you wish to use (e.g. 3DS, OBJ, X, or B3D), and press the 'Options' button. In the options window, double-click on the 'InvertFaceNormals' option to set it to true. After this, you may close all windows and proceed with your export as per normal.

PS: Although I do try to follow L3DT bug reports on other forums via Google Alerts, I would still recommend users report bugs in the official bug reports forum, as you're much more likely to get a timely response and a workaround or bugfix.

Bitmap plugin

The L3DTio_BigBitmap plugin, which provides L3DT with BMP support, has been updated to handle superfluous padding in the data section, which had been found in bitmaps saved by PhotoShop.

Script-defined menu options

Menu options can now be added to L3DT using script files, whereas previously this could only be done using a compiled plugin. Menu options are defined in ZMENU files, which are stored in the following directory:

Win7 / Vista C:\Users\[username]\AppData\Roaming\Bundysoft\L3DT\[version]\Settings\menu
WinXP / 2000 C:\Documents and Settings\[username]\Application data\Bundysoft\L3DT\[version]\Settings\menu

The file(s) in this directory contain one or more menu definitions, which are defined using the ZeoScript language. An example file is given below, in which I show how the 'Operations→Heightfield→Invert' menu option is defined, and following the example file that I will explain the meaning of the contents.

VERSION 1

# comment lines begin with a hash char
# comments within script segments may also use the // comment delimiter

MENU OPERATIONS "Heightfield.Invert"

// the action script just runs another script file, which contains the instructions for inverting the heightfield
int rval
RunScriptFile "Invert Heightfield.zs" rval

ONUPDATE

hvar hmap
set hmap <GetMap "HF">
if <not hmap>
  // disable the menu option if we can't get the heightfield
  set MenuEnable false
  return -1
endif

if <not <map.GetWidth hmap>>
  // disable the menu option if the heightfield has zero width (i.e. is uninitialised)
  set MenuEnable false
  return -1
endif

if <calcman.IsBusy>
  // disable the menu option if the calculation manager is busy
  set MenuEnable false
  return -1
endif

// otherwise, enable the menu option
set MenuEnable true
return 0

END

#more MENU definitions can follow here...

Each menu item beings with a MENU tag, followed (on the same line) by a menu context (e.g. OPERATIONS), and the name of the menu item (e.g. “Heightfield.Invert”, where '.' delimits submenus). The following menu contexts are supported here:

Context Description
OPERATIONS Items will be added to the 'Operations' menu.
EXT_ROOT Items will be added to the 'Extensions' menu.
FILE_IMPORT Items will be added to the 'File→Import' menu.
FILE_EXPORT Items will be added to the 'File→Export' menu.

The menu item action script begins on the line following the MENU tag. This script contains the commands to be executed when the user selects the menu option. The script is terminated by either an END tag, or by an ONUPDATE tag if the menu definition includes an event handler to modify the menu item display state.

The ONUPDATE event handler script, if defined, is called as L3DT is preparing to show the menu. This script may change the menu states for enable (true = enabled, false = greyed/disabled), check (0 = unchecked, 1 = checked, 2 = indeterminate) and radio (true = radioed, false = unradioed). The ONUPDATE script must be terminated by an END tag. Thereafter, another MENU may be defined. Each file may contain any number of menu definitions.

If you have any questions or comments about any of the above changes, please feel free to make use of the forum.

Best regards, Aaron.

 
l3dt/2011/mar/02.txt · Last modified: 2017/08/31 04:44 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Share Alike 3.0 Unported
L3DT Development Blog RSS Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki