Changeset 1181


Ignore:
Timestamp:
08/10/22 13:51:32 (21 months ago)
Author:
sz
Message:

updated for the current Framsticks version 5.0rc23
(WorldMap?.getAstString() and WorldMap? documentation)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • java/Framclipse/com.framsticks.framclipse/res/framscript.xml

    r1180 r1181  
    67936793        </type>
    67946794        <type name="WorldMap" context="Global context">
    6795 <description><![CDATA[Environment details for "Blocks" and "Heightfield" world type. The most important concept is a "Map", which is the array of Map elements. Internally, Maps have more elements than could be deduced from the user-supplied World.wrldsiz, as additional rows of element are added to provide smooth transitions to the flat surroundings.
    6796 
    6797 Blocks: x/ysize=World.wrldsiz+4 rows of blocks (from which only 2+World.wrldsiz rows are placed within the world boundaries)
    6798 
    6799 Smooth: x/ysize=World.wrldsiz+2 rows of vertices (creating World.wrldsiz+1 rows of triangles, everything within the world boundaries)
    6800 ]]></description>
     6795<description><![CDATA[Environment details for "Blocks" and "Heightfield" world type. The most important concept is a "Map", which is the array of Map elements.]]></description>
    68016796                <element name="xsize" type="integer" flags="1"/>
    68026797                <element name="ysize" type="integer" flags="1"/>
     6798                <element name="getAsString" function="true" type="string" flags="32">
     6799                        <description><![CDATA[This function returns the universal polygonal description of the world surface (regardless of the world type). The data is provided in the following simple textual format with each line describing one vertex (3 floating point values) or one face (3 or 4 vertex indices - faces can be triangles or quads), which is a subset of the Wavefront .obj file format:
     6800
     6801v first vertex coordinates
     6802v second vertex coordinates
     6803v ...etc
     6804f first face indices
     6805f second face indices
     6806f ...etc
     6807
     6808For example, the default flat world consists of 4 vertices and 1 quad face:
     6809
     6810v 0 0 0
     6811v 20.0 0 0
     6812v 20.0 20.0 0
     6813v 0 20.0 0
     6814f 1 2 3 4
     6815
     6816Internaly, the data returned by this function is generated by the 'scripts/worldmap-faces.script' file, so you can refer to its source if needed.
     6817The first argument to getAsString() (if not null or empty string) selects an alternate userscript to be used instead of the default "worldmap-faces.script", allowing for extension and customization.
     6818Examples:
     6819WorldMap.getAsString(null,null) //use the default script
     6820WorldMap.getAsString("myscript","myarg") //calls "WorldMap_myscript", passing "myarg" to its main_args() function.]]></description>
     6821                        <arguments>
     6822                                <argument name="alternate script" type="string"/>
     6823                                <argument name="special arguments" type="untyped"/>
     6824                        </arguments>
     6825                </element>
    68036826                <element name="getHeight" function="true" type="float">
    68046827                        <description><![CDATA[Height at any 2d coordinate]]></description>
     
    68096832                </element>
    68106833                <element name="getMap" function="true" type="Object">
    6811                         <description><![CDATA[retrieve map cell object]]></description>
     6834                        <description><![CDATA[Retrieve the map element object for a given grid coordinates (x,y), where 0<=x<xsize, 0<=y<ysize.
     6835
     6836The obtained value type depends on the current world type.
     6837- Blocks world objects provide 'z' and 'type' values (z is the block height, type is 0=flat block, 1=west-east slope, 2=north-south slope).
     6838- Heightfield world objects provide just the 'z' value (which is the grid point height).
     6839
     6840See the 'scripts/worldmap_faces.script' file for a practical example on how to obtain the world geometry data using WorldMap.getMap().
     6841
     6842Quirks: Internally, maps have more elements than could be deduced from the user-supplied World.wrldmap, as additional rows of elements are added to provide smooth transitions to flat surroundings, which is reflected in 'xsize' and 'ysize'.
     6843WorldMap.getMap() arguments refer to this internal representation, so the object corresponding to the first map element is not (0,0), but (1,1) for Heightfield or (2,2) for Blocks world. Not starting from (0,0) can be convenient - for example, given any valid grid coordinates (x,y), all its neighbors are also valid and can be requested through getMap() without introducing any special cases in the code.]]></description>
    68126844                        <arguments>
    68136845                                <argument name="x" type="integer"/>
Note: See TracChangeset for help on using the changeset viewer.