LlIsLinkGLTFMaterial: Difference between revisions

From Second Life Wiki
Jump to navigation Jump to search
Quinn Elara (talk | contribs)
m Add to glTF category.
Quinn Elara (talk | contribs)
Update example.
 
Line 21: Line 21:
     state_entry()
     state_entry()
     {
     {
         integer i = 0;
         integer link = LINK_THIS;
         integer max = llGetNumberOfSides();
         integer i;
         while(i < max)
         for(; i < llGetLinkNumberOfSides(link); ++i)
         {
         {
             string message = "Side " + (string)i + " material is ";
             string message = "Side " + (string)i + " material is ";
             if (llIsLinkGLTFMaterial(LINK_THIS, i))
             if (llIsLinkGLTFMaterial(link, i))
                 message += "GLTF/PBR";
                 message += "glTF/PBR";
             else
             else
                 message += "Blinn-Phong";
                 message += "Blinn-Phong";
             llSay(0, message);
             llSay(0, message);
            ++i;
         }
         }


         if (llIsLinkGLTFMaterial(LINK_THIS, ALL_SIDES))
         if (llIsLinkGLTFMaterial(link, ALL_SIDES))
             llSay(0, "All sides are PBR");
             llSay(0, "All sides are PBR.");
         else
         else
             llSay(0, "Some sides are not PBR");
             llSay(0, "Some sides are Blinn-Phong (not PBR).");
     }
     }
}
}

Latest revision as of 03:26, 26 April 2026


Summary

Function: integer llIsLinkGLTFMaterial( integer link, integer face );
0.0 Forced Delay
10.0 Energy

Returns a boolean (an integer) that is TRUE if the material is PBR and FALSE if it is Blinn-Phong diffuse texture on face

• integer link Link to inspect for PBR, may be LINK_THIS or LINK_ROOT
• integer face Face to examine for PBR, or ALL_SIDES

Caveats

  • Returns FALSE if link does not exist or refers to a multi-link target (such as LINK_SET).
  • Returns FALSE if face does not exist.

Examples

//Tells (on chat) if the materials are PBR
default
{
    state_entry()
    {
        integer link = LINK_THIS;
        integer i;
        for(; i < llGetLinkNumberOfSides(link); ++i)
        {
            string message = "Side " + (string)i + " material is ";
            if (llIsLinkGLTFMaterial(link, i))
                message += "glTF/PBR";
            else
                message += "Blinn-Phong";
            llSay(0, message);
        }

        if (llIsLinkGLTFMaterial(link, ALL_SIDES))
            llSay(0, "All sides are PBR.");
        else
            llSay(0, "Some sides are Blinn-Phong (not PBR).");
    }
}

See Also

Functions

•  llGetNumberOfSides Gets the number of faces on the prim

Deep Notes

Signature

function integer llIsLinkGLTFMaterial( integer link, integer face );