OsSetDynamicTextureDataBlendFace
From OpenSimulator
(Difference between revisions)
(Documentation and example) |
m (fixed some typos) |
||
(28 intermediate revisions by 7 users not shown) | |||
Line 1: | Line 1: | ||
− | + | {{osslfunc | |
+ | |threat_level=VeryLow | ||
+ | |permissions=${OSSL|osslParcelOG}ESTATE_MANAGER,ESTATE_OWNER | ||
+ | |delay=0 | ||
+ | |function_syntax=key osSetDynamicTextureDataBlendFace(string dynamicID, string contentType, string data, string extraParams, integer blend, integer disp, integer timer, integer alpha, integer face) | ||
+ | |description=Renders a dynamically created texture on the face of a prim containing the script, possibly blending it with the texture that is already set for the face. Returns UUID of the generated texture. | ||
+ | |ossl_example=<source lang="lsl"> | ||
+ | // Example of osSetDynamicTextureDataBlendFace used to put a number on each face of a prim | ||
− | + | string FontName = "Arial"; | |
+ | integer FontSize = 128; | ||
− | + | NumberEachFace() { | |
− | + | integer face = llGetNumberOfSides(); | |
+ | while (face--) { | ||
+ | string text = (string)face; | ||
+ | vector size = osGetDrawStringSize("vector", text, FontName, FontSize); | ||
+ | integer xpos = (256 - (integer)size.x) >> 1; | ||
+ | integer ypos = (256 - (integer)size.y) >> 1; | ||
− | + | string commandList = ""; | |
+ | commandList = osMovePen(commandList, xpos, ypos); | ||
+ | commandList = osSetFontName(commandList, FontName); | ||
+ | commandList = osSetFontSize(commandList, FontSize); | ||
+ | commandList = osDrawText(commandList, text); | ||
+ | osSetDynamicTextureDataBlendFace("", "vector", commandList, "width:256,height:256", FALSE, 2, 0, 255, face); | ||
+ | } | ||
+ | } | ||
− | + | default { | |
+ | state_entry() { | ||
+ | NumberEachFace(); | ||
+ | } | ||
+ | changed(integer change) { | ||
+ | if (change & CHANGED_SHAPE) | ||
+ | NumberEachFace(); | ||
+ | } | ||
+ | }</source> | ||
+ | ''' With transparency: ''' | ||
+ | <source lang="lsl"> | ||
+ | // Example of osSetDynamicTextureDataBlendFace used to put a number on each face of a prim with transparency | ||
− | == | + | string FontName = "Arial"; |
− | + | integer FontSize = 128; | |
+ | |||
+ | NumberEachFace() | ||
+ | { | ||
+ | integer face = llGetNumberOfSides(); | ||
− | === | + | while (face--) |
+ | { | ||
+ | string text = (string)face; | ||
+ | vector size = osGetDrawStringSize("vector", text, FontName, FontSize); | ||
+ | integer xpos = (256 - (integer)size.x) >> 1; | ||
+ | integer ypos = (256 - (integer)size.y) >> 1; | ||
− | {| border=" | + | string commandList = ""; |
+ | commandList = osMovePen(commandList, xpos, ypos); | ||
+ | commandList = osSetFontName(commandList, FontName); | ||
+ | commandList = osSetFontSize(commandList, FontSize); | ||
+ | commandList = osDrawText(commandList, text); | ||
+ | osSetDynamicTextureDataBlendFace("", "vector", commandList, "width:256,height:256,Alpha:0", FALSE, 2, 0, 255, face); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | default { | ||
+ | state_entry() { | ||
+ | NumberEachFace(); | ||
+ | } | ||
+ | changed(integer change) { | ||
+ | if (change & CHANGED_SHAPE) | ||
+ | NumberEachFace(); | ||
+ | } | ||
+ | }</source> | ||
+ | ''' With blending: ''' | ||
+ | <source lang="lsl"> | ||
+ | // Example of osSetDynamicTextureDataBlendFace used to put a number on each face of a prim with blending | ||
+ | |||
+ | string FontName = "Arial"; | ||
+ | integer FontSize = 128; | ||
+ | |||
+ | NumberEachFace() | ||
+ | { | ||
+ | integer face = llGetNumberOfSides(); | ||
+ | |||
+ | while (face--) | ||
+ | { | ||
+ | llSetTexture(TEXTURE_PLYWOOD, face); | ||
+ | string text = (string)face; | ||
+ | vector size = osGetDrawStringSize("vector", text, FontName, FontSize); | ||
+ | integer xpos = (256 - (integer)size.x) >> 1; | ||
+ | integer ypos = (256 - (integer)size.y) >> 1; | ||
+ | |||
+ | string commandList = ""; | ||
+ | commandList = osMovePen(commandList, xpos, ypos); | ||
+ | commandList = osSetFontName(commandList, FontName); | ||
+ | commandList = osSetFontSize(commandList, FontSize); | ||
+ | commandList = osDrawText(commandList, text); | ||
+ | osSetDynamicTextureDataBlendFace("", "vector", commandList, "width:256,height:256,Alpha:0", TRUE, 2, 0, 128, face); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | default { | ||
+ | state_entry() { | ||
+ | NumberEachFace(); | ||
+ | } | ||
+ | changed(integer change) { | ||
+ | if (change & CHANGED_SHAPE) | ||
+ | NumberEachFace(); | ||
+ | } | ||
+ | } | ||
+ | </source> | ||
+ | |||
+ | | | ||
+ | }} | ||
+ | |||
+ | |||
+ | {| width="100%" style="border: thin solid black" | ||
+ | | colspan="3" align="center" style=background:orange | '''Parameters''' | ||
+ | |- | ||
|'''Name''' | |'''Name''' | ||
|'''Description''' | |'''Description''' | ||
Line 21: | Line 124: | ||
|- | |- | ||
|'''dynamicID''' | |'''dynamicID''' | ||
− | |UUID of already existing dynamic texture. Intended to accept UUID from a previous call to osSetDynamicTextureXXXX functions in order to provide modification of an existing | + | |UUID of already existing dynamic texture. Intended to accept UUID from a previous call to osSetDynamicTextureXXXX functions in order to provide modification of an existing dynamic texture |
| NOT IMPLEMENTED YET | | NOT IMPLEMENTED YET | ||
|- | |- | ||
Line 27: | Line 130: | ||
|specifies the type of the '''data''' parameter. | |specifies the type of the '''data''' parameter. | ||
The following values are allowed: | The following values are allowed: | ||
− | *vector - the '''data''' parameter contains a list of drawing instructions. See [[Drawing commands]] for details | + | * vector - the '''data''' parameter contains a list of drawing instructions. See [[Drawing commands]] for details |
| | | | ||
|- | |- | ||
Line 37: | Line 140: | ||
|additional optional parameters in the following format: [param]:[value],[param]:[value] | |additional optional parameters in the following format: [param]:[value],[param]:[value] | ||
Multiple parameters are separated by commas. The following ones are supported: | Multiple parameters are separated by commas. The following ones are supported: | ||
− | *width - width of the dynamic texture in pixels (example: width:256) | + | * width - width of the dynamic texture in pixels (example: width:256) |
− | *height - height of the dynamic texture in pixels (example: height:256) | + | * height - height of the dynamic texture in pixels (example: height:256) |
− | *alpha - alpha (transparency) component of the dynamic texture. Values are from 0-clear to 255-solid | + | * alpha - alpha (transparency) component of the dynamic texture. Values are from 0-clear to 255-solid.(example: alpha:255) |
− | *bgcolour - specifies the background color of the texture (example: bgcolour:Red) | + | * bgcolour - specifies the background color of the texture (example: bgcolour:Red) |
− | *altdatadelim - specifies a delimiter between the draw commands contained in the '''data''' parameter. | + | * altdatadelim - specifies a delimiter between the draw commands contained in the '''data''' parameter. |
− | *setalpha | + | * setalpha - integer value is treated like specifying alpha component |
− | + | * lossless - true or false, default false | |
+ | |||
| | | | ||
|- | |- | ||
Line 59: | Line 163: | ||
|- | |- | ||
|'''alpha''' | |'''alpha''' | ||
− | |The alpha value of the generated texture. | + | |The alpha value of the generated texture. 0 (full transparent) to 255 (solid) |
| | | | ||
|- | |- | ||
Line 67: | Line 171: | ||
|} | |} | ||
− | + | '''Notes''' | |
The '''dynamicID''' parameter is not implemented. The value passed will be ignored. | The '''dynamicID''' parameter is not implemented. The value passed will be ignored. | ||
Line 73: | Line 177: | ||
The '''timer''' parameter is not implemented. The value passed will be ignored. Instead, you can use a timer event and recall the function to get the same effect. | The '''timer''' parameter is not implemented. The value passed will be ignored. Instead, you can use a timer event and recall the function to get the same effect. | ||
− | + | '''lossless''' parameter added on version 0.9.1.1, Nov 4th 2019. Old versions did as true, but that should one be used if needed | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | [[Category:OSSL pages in need of parameters template]] | |
− | + | ||
− | + | ||
− | + | ||
− | + |
Latest revision as of 06:21, 25 January 2020
key osSetDynamicTextureDataBlendFace(string dynamicID, string contentType, string data, string extraParams, integer blend, integer disp, integer timer, integer alpha, integer face)
| |
Renders a dynamically created texture on the face of a prim containing the script, possibly blending it with the texture that is already set for the face. Returns UUID of the generated texture. | |
Threat Level | VeryLow |
Permissions | ${OSSL|osslParcelOG}ESTATE_MANAGER,ESTATE_OWNER |
Extra Delay | 0 seconds |
Example(s) | |
// Example of osSetDynamicTextureDataBlendFace used to put a number on each face of a prim string FontName = "Arial"; integer FontSize = 128; NumberEachFace() { integer face = llGetNumberOfSides(); while (face--) { string text = (string)face; vector size = osGetDrawStringSize("vector", text, FontName, FontSize); integer xpos = (256 - (integer)size.x) >> 1; integer ypos = (256 - (integer)size.y) >> 1; string commandList = ""; commandList = osMovePen(commandList, xpos, ypos); commandList = osSetFontName(commandList, FontName); commandList = osSetFontSize(commandList, FontSize); commandList = osDrawText(commandList, text); osSetDynamicTextureDataBlendFace("", "vector", commandList, "width:256,height:256", FALSE, 2, 0, 255, face); } } default { state_entry() { NumberEachFace(); } changed(integer change) { if (change & CHANGED_SHAPE) NumberEachFace(); } } With transparency: // Example of osSetDynamicTextureDataBlendFace used to put a number on each face of a prim with transparency string FontName = "Arial"; integer FontSize = 128; NumberEachFace() { integer face = llGetNumberOfSides(); while (face--) { string text = (string)face; vector size = osGetDrawStringSize("vector", text, FontName, FontSize); integer xpos = (256 - (integer)size.x) >> 1; integer ypos = (256 - (integer)size.y) >> 1; string commandList = ""; commandList = osMovePen(commandList, xpos, ypos); commandList = osSetFontName(commandList, FontName); commandList = osSetFontSize(commandList, FontSize); commandList = osDrawText(commandList, text); osSetDynamicTextureDataBlendFace("", "vector", commandList, "width:256,height:256,Alpha:0", FALSE, 2, 0, 255, face); } } default { state_entry() { NumberEachFace(); } changed(integer change) { if (change & CHANGED_SHAPE) NumberEachFace(); } } With blending: // Example of osSetDynamicTextureDataBlendFace used to put a number on each face of a prim with blending string FontName = "Arial"; integer FontSize = 128; NumberEachFace() { integer face = llGetNumberOfSides(); while (face--) { llSetTexture(TEXTURE_PLYWOOD, face); string text = (string)face; vector size = osGetDrawStringSize("vector", text, FontName, FontSize); integer xpos = (256 - (integer)size.x) >> 1; integer ypos = (256 - (integer)size.y) >> 1; string commandList = ""; commandList = osMovePen(commandList, xpos, ypos); commandList = osSetFontName(commandList, FontName); commandList = osSetFontSize(commandList, FontSize); commandList = osDrawText(commandList, text); osSetDynamicTextureDataBlendFace("", "vector", commandList, "width:256,height:256,Alpha:0", TRUE, 2, 0, 128, face); } } default { state_entry() { NumberEachFace(); } changed(integer change) { if (change & CHANGED_SHAPE) NumberEachFace(); } } |
Parameters | ||
Name | Description | Remarks |
dynamicID | UUID of already existing dynamic texture. Intended to accept UUID from a previous call to osSetDynamicTextureXXXX functions in order to provide modification of an existing dynamic texture | NOT IMPLEMENTED YET |
contentType | specifies the type of the data parameter.
The following values are allowed:
|
|
data | Contains a series of drawing instructions. See Drawing commands for details | |
extraParams | additional optional parameters in the following format: [param]:[value],[param]:[value]
Multiple parameters are separated by commas. The following ones are supported:
|
|
blend | If true, the newly generated texture is blended with the appropriate existing ones on the prim. | |
disp | Display flags. Value 1-expire deletes the old texture if it is replaced by a newer generated texture (may not currently be implemented). Value 2-temp flags the asset as temporary, which often means that it is not persisted to the database. | |
timer | specify a time interval to update the texture | NOT IMPLEMENTED YET |
alpha | The alpha value of the generated texture. 0 (full transparent) to 255 (solid) | |
face | The face of the prim on which to put the generated texture. If ALL_SIDES then all sides of the prim are set. |
Notes
The dynamicID parameter is not implemented. The value passed will be ignored.
The timer parameter is not implemented. The value passed will be ignored. Instead, you can use a timer event and recall the function to get the same effect.
lossless parameter added on version 0.9.1.1, Nov 4th 2019. Old versions did as true, but that should one be used if needed