De DigiWiki.
// ----------------------------------------------------------------
// Example / Sample Script to show function use.
//
// Script Title: osDrawFilledPolygon.lsl
// Script Author:
// Threat Level: None
// Script Source: REFERENCE http://opensimulator.org/wiki/OsDrawFilledPolygon
//
// Notes: See Script Source reference for more detailed information
// This sample is full opensource and available to use as you see fit and desire.
// Threat Levels only apply to OSSL & AA Functions
// See http://opensimulator.org/wiki/Threat_level
//================================================================
// Inworld Script Line: osDrawFilledPolygon( string drawList, list xpoints, list ypoints );
//
integer Touched = FALSE;
default
{
state_entry()
{
llSay(0,"Touch to see osDrawFilledPolygon create a filled blue polygon figure on the prim");
}
touch_end(integer num)
{
if(Touched)
{
Touched = FALSE;
llSetTexture(TEXTURE_PLYWOOD, ALL_SIDES);
}
else
{
Touched = TRUE;
string DrawList = "";
DrawList = osSetPenSize( DrawList, 5 ); // Set the pen width to 3 pixels
DrawList = osSetPenColor( DrawList, "Blue" ); // Set the pen color to blue
// You can use either integer, float or string
DrawList = osDrawFilledPolygon(DrawList, [50.0, 50.0, 150.0], [50.0, 150.0, 150.0]);
// Now draw the polygon
osSetDynamicTextureData( "", "vector", DrawList, "", 0 );
llSay(0,"Touch again to revert back to plywood texture");
}
}
}
// Example of osDrawFilledPolygon
default
{
state_entry()
{
// Storage for our drawing commands
string CommandList = "";
// Set the pen width to 3 pixels
CommandList = osSetPenSize( CommandList, 3 );
// Set the pen color to blue
CommandList = osSetPenColor( CommandList, "Blue" );
// You can use either integer, float or string
CommandList = osDrawFilledPolygon( CommandList, [50,100,50], ["50",100,150.0] );
// Now draw the polygon
osSetDynamicTextureData( "", "vector", CommandList, "", 0 );
}
}