Created
April 3, 2015 09:12
-
-
Save antonyfairport/f9f9632a5d9a97422710 to your computer and use it in GitHub Desktop.
Show some simple information about LOD switching distances for a given mesh object.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
////////////////////////////////////////////////////////////////////// | |
// Z&A Mesh Info | |
// By Antony Fairport | |
// | |
// Z&A Mesh Info - Simple tool to help figure how when LOD switches | |
// happen. Based on the information made available via an article in | |
// http://en.calameo.com/read/000004234610f002a5334 and, from that, in | |
// http://wiki.secondlife.com/wiki/Mesh/Mesh_Streaming_Cost | |
// | |
// Revision history: | |
// ------------------------------------------------------------ | |
// | |
// 2015-04-02 | |
// Initial revision. | |
////////////////////////////////////////////////////////////////////// | |
// Calculate and show the mesh information. | |
ShowMeshInfo() | |
{ | |
vector vBox = llGetScale(); | |
float nDiameter = llSqrt( | |
( vBox.x * vBox.x ) + | |
( vBox.y * vBox.y ) + | |
( vBox.z * vBox.z ) | |
) / 2; | |
llOwnerSay( | |
"At standard viewer settings the LOD changes for this object should be:\n" + | |
"High to medium: " + ( (string) ( nDiameter / 0.24 ) ) + " m\n" + | |
"Medium to low: " + ( (string) ( nDiameter / 0.06 ) ) + " m\n" + | |
"Low to lowest: " + ( (string) ( nDiameter / 0.03 ) ) + " m" | |
); | |
} | |
////////////////////////////////////////////////////////////////////// | |
// Default state. | |
default | |
{ | |
////////////////////////////////////////////////////////////////// | |
// Do stuff when we enter this state. | |
state_entry() | |
{ | |
ShowMeshInfo(); | |
} | |
////////////////////////////////////////////////////////////////// | |
// Do stuff when someone touches us. | |
touch_start( integer _ ) | |
{ | |
// But only if it's the owner. | |
if ( llDetectedKey( 0 ) == llGetOwner() ) | |
{ | |
ShowMeshInfo(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment