Professional Web Applications Themes

Dynamic Texture Assignment - Macromedia Director 3D

Hiya people, I have the following setup: A button which cycles through textures in an adjacent 2D sprite A 3D cast member which gets updated with the texture currently residing in the aforementioned 2D sprite (the textures are looped so if you keep pressing the button you will eventually get back to the starting texture) I tried some basic scripting to make this happen (i'm quite new to Director 3D) and it worked the first time the texture was apllied but i keep getting 'shadername already exsists' once a texture that has already been on display is re-applied to the ...

  1. #1

    Default Dynamic Texture Assignment

    Hiya people,

    I have the following setup:

    A button which cycles through textures in an adjacent 2D sprite

    A 3D cast member which gets updated with the texture currently residing in
    the aforementioned 2D sprite (the textures are looped so if you keep
    pressing the button you will eventually get back to the starting texture)

    I tried some basic scripting to make this happen (i'm quite new to Director
    3D) and it worked the first time the texture was apllied but i keep getting
    'shadername already exsists' once a texture that has already been on display
    is re-applied to the model.

    Any ideas on the scripting needed to overcome this?

    Thanks


    Jay Guest

  2. #2

    Default Re: Dynamic Texture Assignment

    -- Check whether the shader already exists

    if voidP(member("scene").shader("shadername")) then
    pShader = member("scene").newShader("shadername", #standard)
    else
    pShader = member("scene").shader("shadername")
    end if



    Karl Sigiscar Guest

  3. #3

    Default Re: Dynamic Texture Assignment

    Right, but how do i make it so that the shader name is always unique? Can't
    i simply refer to the shadername that was created the first time that
    texture was displayed?



    "Karl Sigiscar" <karl.sigiscarlaposte.net> wrote in message
    news:bn8p6b$ekh$1forums.macromedia.com...
    > -- Check whether the shader already exists
    >
    > if voidP(member("scene").shader("shadername")) then
    > pShader = member("scene").newShader("shadername", #standard)
    > else
    > pShader = member("scene").shader("shadername")
    > end if
    >
    >
    >

    Jay Guest

  4. #4

    Default Re: Dynamic Texture Assignment

    Jay wrote:
    > Right, but how do i make it so that the shader name is always unique?
    Haven´t been following the thread so sorry if this makes no sense but
    one possible answer to this question is concatenating the milliseconds
    to the shader´s name:

    shName = "my new shader" && string(the milliseconds)

    Bye
    --
    Agustín María Rodríguez | [email]agustinOnWine.com.ar[/email] | [url]www.OnWine.com.ar[/url]

    Agustín María Rodríguez Guest

  5. #5

    Default Re: Dynamic Texture Assignment

    That's just what this code snippet does. It creates the shader of name
    shadername if it doesn't exist yet. Otherwise, it creates a reference to the
    existing shader with the unique name shadername, the one that was first
    created.

    if voidP(member("scene").shader("shadername")) then
    pShader = member("scene").newShader("shadername", #standard)
    else
    pShader = member("scene").shader("shadername")
    end if


    "Jay" <jayfield1979msn.com> a écrit dans le message news:
    bn8rno$jkk$1forums.macromedia.com...
    > Right, but how do i make it so that the shader name is always unique?
    Can't
    > i simply refer to the shadername that was created the first time that
    > texture was displayed?
    >
    >
    >
    > "Karl Sigiscar" <karl.sigiscarlaposte.net> wrote in message
    > news:bn8p6b$ekh$1forums.macromedia.com...
    > > -- Check whether the shader already exists
    > >
    > > if voidP(member("scene").shader("shadername")) then
    > > pShader = member("scene").newShader("shadername", #standard)
    > > else
    > > pShader = member("scene").shader("shadername")
    > > end if
    > >
    > >
    > >
    >
    >

    Karl Sigiscar Guest

Similar Threads

  1. Dynamic assignment.
    By limitedwave777 in forum Macromedia Flex General Discussion
    Replies: 0
    Last Post: May 7th, 12:59 AM
  2. Help with an assignment.
    By Azrael MacCool in forum Macromedia Dynamic HTML
    Replies: 6
    Last Post: January 30th, 07:45 PM
  3. USING DYNAMIC LOADED JPG AS TEXTURE IN 3D OBJECT
    By nmx_shadow in forum Macromedia Director 3D
    Replies: 1
    Last Post: September 16th, 04:20 PM
  4. Assignment
    By Hans & Christine Pedersen in forum ASP Database
    Replies: 2
    Last Post: July 30th, 05:34 AM
  5. Parallel Assignment # a,b=c,d=1,2
    By Sam Roberts in forum Ruby
    Replies: 0
    Last Post: June 29th, 09:14 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139