Game Development Community

dev|Pro Game Development Curriculum

3D Text Control

by Frank Bignone · 11/24/2004 (6:00 pm) · 6 comments

Download Code File

Here is a simple GUI control which will allow the following:
- display a 3D text
- for each letter of your text display a DTS shape instead according to the letter
- when mouse is over your control, play a selected effect

This GUI is based on the TSControl and on the ObjectViewer control. I have also added the light manager extension done previously by a GG member (forget his name, sorry).

First of all, the GuiText3D object:
new GuiText3D() {
      profile = "GuiDefaultProfile";
      horizSizing = "center";
      vertSizing = "bottom";
      position = "153 4";
      extent = "417 109";
      minExtent = "8 2";
      visible = "1";
      cameraZRot = "0";
      forceFOV = "0";
      ShapeBase = ./base";
      text = "Dog of Prey";
      rotation = "90 0 0";
      lightDirection = "-0.57735 -0.57735 -0.57735";
      lightColor = "0.600000 0.00000 0.000000 1.000000";
      ambientColor = "0.300000 0.000000 0.000000 1.000000";
      fxId = 1;
      fxParams = "0 1 0";
   };

Main parameters are the following:
- text : your text
- shapeBase : basename of the dts files.
- rotation : global rotation on your text
- fxId & fxParams : settings for the effects when mouse is over the control

Concerning the dts models for your text, you should have one model per letter and named it foo_ASCII CODE.dts as shown in the provided example.

Concerning the fx, at the moment there is two fx:
- fxId = 1: rotation of each letter, fxParams = rotX vel, rotY vel, rotZ vel
- fxId = 2: sin wave, fxParams = X Amplitude Y, Amplitude, Z Amplitude, w/char position, w/time

If you want to add some more fx, it is very simple in the provided C++ code. Moreover, this code is still in process and adds already some support for DTS animation but no script functions to trigger it.

Here are two example:
- Letter rotation
- Letter sin wave

It supports also the command parameters, so when you click on it it will execute a script function like a button.

If you use this control, I will be very glad if you can share with me your 3D letter models as I'm not an artist at all ;)

About the author

Real programmers don't waste time recompiling; they patch the binary files... ... Real programmers don't waste time patching binary files; they patch memory.


#1
11/27/2004 (9:23 am)
Cool resource, not sure what I could use it for but if I ever do and paint some 3d fonts, I'll send them to your email.
#2
11/27/2004 (7:40 pm)
now thats pretty slick..:)
#3
07/20/2005 (6:38 pm)
Frank,...this thing is not working on my engine...where do i put the dts files?... and where do i place the example script?..please help
#4
07/26/2005 (11:25 pm)
Fatal: (gui/guiText3D.cc @ 142) [GuiText3D] Failed to allocate char render struct
#5
11/01/2006 (1:36 am)
It doesn't work for me. Hope you can give us a full instruction about how to use it. Thanks!
#6
09/22/2009 (9:14 am)
Hi Frank, I'm trying to get this working in T3D and am having problems - did you/anyone else ever port a version to TGEA?