OsSetDynamicTextureDataBlendFace

De DigiWiki.

(Différences entre les versions)
(Page créée avec « <lsl> // Example / Sample Script to show function use. // // Script Title: osSetDynamicTextureURLBlendFace.lsl // Script Author: // Threat Level: VeryLow // // Notes: T… »)
Ligne 1 : Ligne 1 :
<lsl>
<lsl>
-
// Example / Sample Script to show function use.
+
// Example of osSetDynamicTextureDataBlendFace used to put a number on each face of a prim
-
//
+
-
// Script Title:    osSetDynamicTextureURLBlendFace.lsl
+
-
// Script Author:
+
-
// Threat Level:    VeryLow
+
-
//
+
-
// Notes: This sample is full opensource and available to use as you see fit and desire.
+
-
// Threat Levels only apply to OSSL & AA Functions
+
-
// ================================================================
+
-
// C# Source Line:    public string osSetDynamicTextureURLBlendFace(string dynamicID, string contentType, string url, string extraParams, int blend, int timer, int alpha, int face)
+
-
// Inworld Script Line: osSetDynamicTextureURLBlendFace(string sDynamicID, string sContentType, string sURL, string sExtraParams, integer iBlend, integer iTimer, integer iAlpha, integer iFace);
+
-
//
+
-
// Example of osSetDynamicTextureURLBlendFace
+
-
//
+
-
// ExtraParams Values:
+
-
//    width - width of the dynamic texture in pixels (example: width: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, and false to turn off the alpha layer completely (example: alpha:255)
+
-
//    bgcolour - specifies the background color of the texture (example: bgcolour:Red)
+
-
//    setalpha
+
-
//    integer value - any integer value is treated like specifing alpha component
+
-
default
+
string FontName = "Arial";
-
{
+
integer FontSize = 128;
-
     state_entry()
+
-
     {
+
NumberEachFace() {
-
         llSay(0,"Touch to see osSetDynamicTextureURLBlendFace used to render Web Based Image/Texture on a prim");
+
     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);
     }
     }
-
   
+
}
-
     touch_start(integer total_num)
+
-
    {
+
default {
-
         string sDynamicID = "";                          // not implemented yet
+
     state_entry() {
-
        string sContentType = "image";                  // vector = text/lines,etc.  image = texture only
+
         NumberEachFace();
-
        string sURL = "http://www.goes.noaa.gov/FULLDISK/GMVS.JPG"; // URL for WebImage (Earth Shown)
+
    }
-
        string sExtraParams = "width:512,height:512";   // optional parameters in the following format: [param]:[value],[param]:[value]
+
    changed(integer change) {
-
        integer iBlend = TRUE;                          // TRUE = the newly generated texture is iBlended with the appropriate existing ones on the prim
+
         if (change & CHANGED_SHAPE)
-
        integer iDisp = 2;                              // 1 = expire deletes the old texture.  2 = temp means that it is not saved to the sDatabase.
+
            NumberEachFace();
-
         integer iTimer = 0;                              // timer is not implemented yet, leave @ 0
+
-
        integer iAlpha = 255;                            // 0 = 100% Alpha, 255 = 100% Solid
+
-
        integer iFace = 0;                      // Faces of the prim, Select the Face you want
+
-
        // Set the prepared texture to the Prim
+
-
        osSetDynamicTextureURLBlendFace( sDynamicID, sContentType, sURL, sExtraParams, iBlend, iDisp, iTimer, iAlpha, iFace );
+
     }
     }
}
}
</lsl>
</lsl>

Version du 23 novembre 2012 à 14:44

// 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();
    }
}
Outils personnels
donate
Google Ads