Version Française English Version [ Lingo 3D Scripts for Macromedia Director ]  

Last Updates Last Updates
 
Xtras Xtras
o
o
o
o
o
3D-UDI
BinFileIO
Joystick
SetMouseLoc
PointInside...
 
Shockwave Demo Shockwave
 o
o
o
o
Jeu de la Vie
Arbre
The Legend of Zelda
Zelda Breakout
 
3D Lingo Lingo 3D
 o
o
o
o
Model Highlighter
Text On Screen
Text To Texture
Animated Texture
 
3D Lingo Lingo
 o


Save an image to disk
 
3D Lingo Pogopixels - Widgets, Flash and Web Applications

Lingo Parent Script [3D] Model Highlighter

See the Shockwave demo

Download the source code

This parent script allows highlighting the model under the cursor by changing its emissive property. It can be used, for example, to create "rollover" effects in a 3D world.

To use it, first create a new instance of cHighlightModels with a 3D member as a parameter:

world3D = member("world3D")
HLInstance = script("cHighlightModels").new(world3D)

Then, add the models that will be affected by the instance (that is which models can be highlighted).

HLInstance.affectModel(world3D.model(1))
HLInstance.affectModel(world3D.model(3)) -- etc.

If necessary, you can also remove a model using this handler:

HLInstance.excludeModel(world3D.model(3))

Finally, to update the models and to do a treatment on the models that is highlighted you can use the update() handler (for the detail of what it does, please have a look at the source code) :

-- This can be added, for example, in an "enterFrame" handler :
highlightedModel = HLInstance.update(the mouseLoc)
put highlightedModel.name && "is selected!"


Lingo Parent Script [3D] TextOnScreen

See the Shockwave demo

Download the source code

TextOnScreen allows drawing text on screen inside a 3D Sprite. To use it, first copy "cTextOnScreen" and "cTextToTexture" classes in your movie. Then create a new instance of "cTextOnScreen" passing a 3D sprite and a text member as parameters:

textOnScreen = script("cTextOnScreen").new(member("world"), member("text"))

Then to add text:

textOnScreen.write("some text") -- adds "some text" at the end of the line
textOnScreen.writeln("some other text") -- adds "some other text" and add a carriage return

To update the text on screen, use:

textOnScreen.update()

"cTextOnScreen" has also some additional functions in order to set a transparent background or not:

textOnScreen.transparentBackground(FALSE) -- TRUE by default

to change the background colour:

textOnScreen.setBackgroundColor(rgb(255,0,0)) -- for a red background

to change the text position:

textOnScreen.setPosition(point(10,10)) -- moves the text to the position (10,10)

to change the text scale:

textOnScreen.setScale(2) -- doubles the text size

and some other less important functions (please see the source code for more details!).


Lingo Parent Script [3D] TextToTexture

See the Shockwave demo

Download the source code

TextToTexture converts a text member to a texture. Actually, this class works almost the same way as cTextOnScreen. Thus to create an instance, to add text and to update the texture, use the following methods:

textToTexture = script("cTextToTexture").new(member("world"), member("text")
textToTexture.write("some text")
textToTexture.writeln("some text with a carriage return")
textToTexture.update()

To get a reference to the created texture, use getTexture(). For example, to assign the texture to a "box" model:

member("world").model("box").shader.texture = textToTexture.getTexture()


Lingo Parent Script Animated Texture

See the Shockwave demo

Download the source code

This script creates an animated texture from a sequence of numbered images. To use it, first create a new instance of "cAnimatedTexture". The constructor takes four parameters: a 3D member, the name of the sequence, the number of the first image and the number of the last image. For example, for the sequence that goes from "my video 001" to "my video 150":

animatedTexture = script("cAnimatedTexture", member("3DWorld"), "my video ###", 1, 150) -- the script will replace the ### by the number 001 to 150

By default, the frame rate is the same as the one of the movie; however it's possible to change it using:

animatedTexture.setFrameRate(25) -- (for 25 images / second)

To apply this texture to an object or an overlay, use the getTexture() function. This function returns one of the textures (frames) according to the elapsed time and the framerate of the animation. For example, it can be called in an exitFrame or enterFrame event:

on enterFrame me
   -- applies the animation to a model:
   myModel.shader.texture = animatedTexture.getTexture()
   -- applies the animation to an overlay:
   myCamera.overlay[1].source = animatedTexture.getTexture()
end

When calling getTexture, you can specify an offset. This allows having several models with the same animated texture without having a synchronisation between them:

-- Applies the same texture to the two monsters but with a 10 frames
-- offset for the second monster. That way, they won't look identical:
myFirstMonster.shader.texture = animatedTexture.getTexture()
mySecondMonster.shader.texture = animatedTexture.getTexture(10)


23/05/2003 - counter