7 digit alphanumeric display

About Truespace Archives

These pages are a copy of the official truespace forums prior to their removal somewhere around 2011.

They are retained here for archive purposes only.

7 digit alphanumeric display // Scriptorium

1  2  |  

Post by ProfessorKhaos // Feb 7, 2007, 1:03pm

ProfessorKhaos
Total Posts: 622
pic
Illustration of how margins, sharpness, and font dimensions work together...


Output Bitmap Width = (Left Margin + Width + Right Margin) * Sharpness

Output Bitmap Height = (Top Margin + Font Height + Bottom Margin) * Sharpness


Knowing that font height is 8 (8x8 font) you can calculate the final output resolution if you so desire. Background texture quality is preserved to the extent possible given the output bitmap size.


Sharpness comes at a cost though... top image is actually far more efficient than bottom image despite similar output resolution. This is because of the increased number of character related pixels being filled. Text in top image is very small, thus very few pixels to fill. Bottom image is 5*5 times more pixels or 25 times as much work. Middle image is roughly the same efficiency as the top image because character related pixels is similar (minus cropping effect) but detail loss is very visible due to background resampling and pixel blending.


see last post of previous page for latest version of Dot Matrix Display MkVc.

Post by trueBlue // Feb 7, 2007, 8:01pm

trueBlue
Total Posts: 1761
pic
This is great! I was messing around with a constant shader with it. I do not beleive it is a real constant shader though. So many more possibilities with this version. Very Cool! Hey you do know that the Scriptorium is seperate from the trueSpace forum in that only a selected few by Norm have access here, right?

Post by ProfessorKhaos // Feb 7, 2007, 8:59pm

ProfessorKhaos
Total Posts: 622
pic
Wasn't sure about that given that I've seen it move around a bit in forum placement. I'll repost in one of the other areas. Hmmm... monster garage or interactive artwork? Dunno which one is more appropriate. Maybe just tag on to the end of my thread in interactive artwork for now. Future projects should probably go in monster garage when they're modular script functions such as these.


Glen

Post by ProfessorKhaos // Feb 8, 2007, 4:46am

ProfessorKhaos
Total Posts: 622
pic
Been thinking about it a little more and it seems the old interface controls are a bit unnecessarily complicated.


Most folks who use a background image will likely want a better method to control output resolution as they suffer the most detail loss.


Since output resolution is affected by multiple factors (see equations above) it becomes a bit of a "mathematical mental challenge" to place text within the image while maintaining detail.


So... here's the pitch.


Instead of giving margins (which were tied more strongly to old polygon model) how about the following:


user can enter:


final output bitmap resolution


anchor point for text (top, bottom, left, right, left top, right top (default), left bottom, right bottom, center: I may just use numbers 0 - 8 to select rather than text and tie it to radio buttons)


x,y location in output bitmap of anchor point.


text scale X (must be an integer value >= 1)

text scale Y (must be an integer value >= 1)


text width (in pixels, determines cropping of display when contained within output bitmap)


I think the above might be more intuitive to use than messing with the existing model. It also gives you more precision on a pixel level as to the exact alignment of the text when using larger text scales.


I may have a better way to fill the output background with the solid background color too. Existing method takes more time than necessary. Using a bitmap background is actually quicker with above versions.


v/r,


P.K.

Post by trueBlue // Feb 8, 2007, 8:38am

trueBlue
Total Posts: 1761
pic
That sounds great and maybe with the radio buttons you could have one Edit Box that updates the choosen number. IE: Radio #1 = Top.

Post by Emma // May 1, 2007, 5:06am

Emma
Total Posts: 344
pic
Did a rearange of the script part for the segment display, ( the one of the earlyer version ! ) CORRECTION: its the one only used so far in Game15 of trueSpace 7.5 release


For another script idea I'm working on I found this segment display quite useful. When studying the script code I had some ideas of trying out if it could be more universal used. So first thing I did was rearanging the character set organization.


This opens the possibility to handle everything now within loops. The extension of characters could be done by increasing one variable and adding for each character simply one more column.

Future changes could be be loading the character set from external file, or changing matrix/segments, input as HEX and not as 0/1, other possibilities.


Go down to script part "1 digit display" and then into sixteen_seg-led_driver

The whole script is commented in details so hope it explains itself.


Perhaps useful for others ?


Checked the script, but be sure there still may be errors, so better double check.


// OnComputeOutputs

// Called to compute values of all output connectors

function OnComputeOutputs(params)

{

// this script originates from the original 16Digit-script from ProfessorKhaos

// code is changed to a field organized structure to allow loop oriented scripting

// March/April 2007 : 30042007-19:04

//

// Ana XXxxXXxx.... XX = segment name

// Anb start value for spMaterialStream index

// Anc index increment value for index of spMaterialStream.index

//

//

inString = params.conValue('inString');

Mesh = params.ConValue('inMesh');


Aseg = 17; // number of segments



var Ap = new Array (Aseg); // character 17 Segment controling, 1 = ON / 0 = OFF

var ApOut = new Array (Aseg); // used for status value 2/-1 for spMaterialStream

var currChar = "";

var nextChar = "";

//************************

// FONT DEFINITION STRINGS

//************************



Ana = "A1A2B C D1D2E F G1G2H I J K L M DP"; // segment name

Anb = "4407031021504036471832551428532488"; // start value spMaterialStream XXxxXXxx..

Anc = "33443344334244246"; // # of spMaterialStream assigns XxXxX..


AmNr = 56; // number of showable characters in Am

Am ="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789$%*+-=?@}{][<>\/_',.";

Ap[0] ="11111110000000111111000001101101111111000001101000 000000";

Ap[1] ="11111110000000111111000001101101111110000011010100 000000";

Ap[2] ="11010001010011111100101000111110011100000011000000 000000";

Ap[3] ="11010011010011101010101000110110111111000000000000 000000";

Ap[4] ="01111010010100101010100001101101101111000101010100 001000";

Ap[5] ="01111010010100101010100001101101101110000101101000 001000";

Ap[6] ="10101111011111111100111000101000101000000001000000 000000";

Ap[7] ="10101111001111111110111000100011101111000001000000 000000";

Ap[8] ="10001101000000010110000000001111101111111100010000 000000";

Ap[9] ="11001001000000010110000000001110101111111111100000 000000";

Ap[10] ="00000000000011000000000110000000000011110001111101 100000";

Ap[11] ="01010000100000000001000000000000000000000000000000 000000";

Ap[12] ="00000000001010000000010111100000000001100000000010 010100";

Ap[13] ="00000000000000000000011101100000000001100000000001 010000";

Ap[14] ="01010000100000000001000010000000000011110010111100 000000";

Ap[15] ="00000000001001001100001100000001000000100000000010 100000";

Ap[16] ="00000000000000000000000000000000000000000000000000 000011";

scanStringDP = ".,";


//**********************

// DEFAULT OUTPUT STATES

//**********************

for (i=0; i<Aseg; i++)

{

ApOut[i] = 2; // loop instead of assigning value of 2 to each single segment

}

outString = "";


//*************

// PREPARE VARS

//*************

inString = inString.toUpperCase();


if (inString.length > 0) // check if there is a character to handle

{

currChar = inString.substr(0,1); // get the Input characterfrom the outer world

if (inString.length > 1)

nextChar = inString.substr(1,1) // in case of decimalpoint DP we have two chars


//************************************************** *******************

// TEST FOR SEGMENTS setttings: 1 = ON -- 2 = OFF saved in ApOut[ ]

//************************************************** *******************

for (i=0; i<Aseg; i++) // lopp runs through Ap[0]

{ pipi = Am.indexOf(currChar); // position in string Am, used as index in Ap[x]

fax = Ap[i];

pfp = fax.charAt(pipi); // value 0/1 for corresponding instring

if ( pfp == 1)

{ ApOut[i] = 1; } // now set ON/OFF corresponding segment

if ( pfp == 0 )

{ ApOut[i] = 2; }


}


//************************************************** ***********************

// FOLLOW ON CHARACTER HANDLINGin case we have additionally decimal points

//************************************************** ***********************

if (inString.length > 1)

{

nextChar = inString.substr(1,1);

if (scanStringDP.indexOf(currChar) == -1 && scanStringDP.indexOf(nextChar) != -1)

{ outColDP = 1;

if (inString.length > 2)

{

outString = inString.substr(2);

}

else

{ outString = "" }

}

else

{ outString = inString.substr(1); }

else

{ outString = ""; }

}

else { outString = ""; }


//*****************************

// SET DISPLAY ELEMENTS IN MESH

//*****************************

numTriangles = Mesh.GetNumTriangles();


if (!numTriangles)

{

params.ConValue("outString") = outString;

params.ConValue("Mesh") = Mesh;

return;

}


spMaterialStream = Mesh.GetTrianglesStreamByName('Material Index Stream Data');


for (i=0; i<Aseg; i++) // loop to feed the Mesh

{

jin = parseInt(Anb.substr(i*2,2)) // start value from Anb;

jan = parseInt(Anc.substr(i,1)) // number of increment steps;


for (j=0; j<jan; j++)

{

spMaterialStream.index(jin) = ApOut[i]

jin = jin+1;

// System.Alert(i+" - "+jin+" - "+jan+" - "+j+" - "+ApOut[i]+" ApOut: "+ApOut);

}

// System.Alert(ApOut+" - "+ApOut[i]);

}


Mesh.AttachTrianglesStream(spMaterialStream);


//****************

// POPULATE RESULT

//****************

params.conValue("outString") = outString;

params.ConValue("Mesh") = Mesh;

}

Post by 3dvisuals dude // Aug 25, 2007, 2:04am

3dvisuals dude
Total Posts: 1703
pic
Hi P.K.,

I have a need for something which may be related to your work here.

I need to have a long narrow 3D rectangular display serve as a marquee display for laterally scrolling lines of text.

Basically it would be sort of a 3D version of those annoying little status bar scrolling text marquee jscripts we are all familiar with in web browsers, only this would be a version which reads input text from a jscript and scrolls it out in a dot matrix fashion across a 3D plane.

These would serve as information panels within single or multi-user truePlay scenes to assist travelers there in numerous ways.

Would this be difficult to implement in trueSpace scripting for any reason?

If not, is what you have already created here easily modifiable toward that desired end, or do you think it would be best to take a different approach altogether toward that objective?

Thanks for your help,

Mark / 3dvisuals dude

Post by Norm // Aug 25, 2007, 4:17am

Norm
Total Posts: 862
pic
the Speak object could be useful as well.

Post by 3dvisuals dude // Aug 25, 2007, 4:41am

3dvisuals dude
Total Posts: 1703
pic
the Speak object could be useful as well.

Right Back at ya buddy!:D

- 3dvisuals dude
Awportals.com is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2024. All Rights Reserved.
Awportals.com   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn