Skip to content

Instantly share code, notes, and snippets.

@antonyfairport
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save antonyfairport/713a8c1a3ceda7b09d82 to your computer and use it in GitHub Desktop.
Save antonyfairport/713a8c1a3ceda7b09d82 to your computer and use it in GitHub Desktop.
Simple script to texture an object to show face numbers.
//////////////////////////////////////////////////////////////////////
// Z&A Show Face Numbers
// By Antony Fairport
//
// Z&A Show Face Numbers - Quickly show face numbers on an object.
//
// Revision history:
// ------------------------------------------------------------
//
// 2015-02-19
// Initial revision.
//////////////////////////////////////////////////////////////////////
// Number textures.
list NUMBERS = [
"de4264f4-a3bb-d173-8db4-db469d19d844",
"d7820e37-87f5-c967-4708-17e5bbd3e4dd",
"a66c055c-a50e-5757-a0a7-f8e149cb39d6",
"4c3c9511-04f6-793f-17b8-c920a51dc98c",
"25589b6a-2281-01ae-7926-3fe406e4277d",
"f8250b58-85bd-5889-1589-fcc08607952f",
"a451b6c7-2e18-9935-df8d-f0bdabdacd06",
"b66c6b13-3948-e003-f61a-81e5624a71dd",
"644e1a49-e3fe-1293-c397-29fc920e6bb5",
"2918ac2f-e8a3-c73d-0926-8d14ef8eef9f"
];
//////////////////////////////////////////////////////////////////////
// Texture all faces on all objects in the linkset.
TextureFaces()
{
// Build up the texture rules.
integer iMax = llGetListLength( NUMBERS );
list lRules;
integer i;
for ( i = 0; i < iMax; i++ )
{
lRules += [
PRIM_TEXTURE, i, llList2String( NUMBERS, i ), < 1.0, 1.0, 0.0 >, ZERO_VECTOR, 0.0
];
}
// Set the textures.
llSetLinkPrimitiveParamsFast( LINK_SET, lRules );
}
//////////////////////////////////////////////////////////////////////
// Default state.
default
{
//////////////////////////////////////////////////////////////////
// Do things when we enter this state.
state_entry()
{
// Get straight to the work of texturing the faces.
TextureFaces();
}
//////////////////////////////////////////////////////////////////
// React to any changes we might be interested in.
changed( integer change )
{
// A change of shape, or linking, really needs...
if ( ( change & CHANGED_SHAPE ) || ( change & CHANGED_LINK ) )
{
// ...a refresh of the textures.
TextureFaces();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment