Graphics

 View Only
  • 1.  Multi-polygon object in Xpression

    Posted 02-02-2022 13:36

    Hi there!

    Been a while since I posted a question here now.
    I'm trying to do something in Xpression now that I have never done before, I'm trying to create a Radial Line Graph, or a Polar Line Chart if you wish.

    I stumbled across this post from 2014:
    https://livinglive.community/communities/community-home/digestviewer/viewthread?GroupId=199&MID=24053&CommunityKey=91812bfd-9393-4a3f-8a74-7f8035df130e&tab=digestviewer

    And while that one kinda got my hopes down, I'm just thinking, we now have the "lines" object in Xpression, and I do believe I could get this to do what I want in some way.
    However, that gives me a line, a rather thin one at that in 2D. I was hoping I could make a filled in shape with it, or otherwise fill it somehow, anyone got an idea?



    ------------------------------
    Aleksander Stalsberg
    Lillehammer Icehockey Club
    ------------------------------


  • 2.  RE: Multi-polygon object in Xpression

    Posted 02-02-2022 16:59

    So I figured I'd give this a shot by scripting. So I searched for "lines" in the SDK, and got this gem of a page showing me how to create simple geometric shapes etc.

    The example script to just show how to create a line, a circle and a square is:

    'create a new XPression engine instance
    dim Engine as new xpEngine
    'dim a material variable
    dim Mat as xpMaterial
    'dim an APITexture shader variable
    dim APITexture as xpAPITextureShader
    'dim a Pen object variable
    dim Pen as xpPen

    'retrieve "material1" from the project (see assumptions above)
    Engine.GetMaterialByName("Material1", Mat)

    'retrieve the APITexture shader from the material
    Mat.GetShaderByName("APITexture", APITexture)

    'create the Pen instance
    Pen = Engine.CreatePen
    'set the Pen's size to 20
    Pen.Size = 20
    'set the Pen's color to blue and alpha to full
    Pen.SetColor(0, 0, 255, 255)

    'now draw a single blue line from xy coordinate 100,100 to xy coordinate 360,360
    APITexture.DrawLine(Pen, 100, 100, 360, 360)

    'set the Pen's color to green and alpha to full
    Pen.SetColor(0, 255, 0, 255)
    'draw a green circle with a diameter of 400 pixels at xy location 30,30
    APITexture.DrawEllipse(Pen, 30, 30, 400, 400)

    'set the Pen's color to red and alpha to full
    Pen.SetColor(255, 0, 0, 255)
    'and draw a red rectangle around the previous two primitives
    APITexture.DrawRect(Pen, 10, 10, 440, 440)

    Now for this to work, they have a few prerequisites:

    In the examples below it is assumed that a material named "Material1" exists in the project and this material should contain an APITexture shader named "ApiTexture".

    Now that is all fair and good, and material made with the APITexture named correctly based on the script (should actually be APITexture, not ApiTexture).
    And I could skip the first two lines with "dim Engine as new xpEngine" as they are allready declared in the "OnOnline" event for the scene (will throw an error compiling as well).

    But I dont get anything? Completly black in the Virtual Output?



    ------------------------------
    Aleksander Stalsberg
    Lillehammer Icehockey Club
    ------------------------------