Hi everyone.
I'm quite a newbie in programming, and just learned processing for about 2 months. I'm currently working on a marker based augmented reality program using Nyartoolkit for my school project. The idea is to display a 3d models, texts (a name for each model), and play a sound for each model that can be re-triggered with a key press. So with my very limited knowledge on programming (not to mention bad English) I wrote a code based on many tutorials and processing references. The code itself works fine as I wanted, but as you can see, it's a mess and inefficient, especially the audio sample trigger part. I need the trigger so the sound do not overlap with each other when a key is pressed, but all i can do is to write all the boolean trigger for each marker tracking. I already tried to simplify it with boolean array, but I can't get it to work. I plan to put more than 20 models so I think the code will be too much. Please help me to use boolean array, or is there a better way?
By the way I use processing 1.2. and here's the code:
// if *any* markers have been detected this will be true if (nya.detect(cam)) { // depth test back on, we're going to draw 3D YEAH!! hint(ENABLE_DEPTH_TEST); // for all detected markers: for (int i=0; i < nya.markers.length; i++) { if (nya.markers[i].detected) { // set the model-view transform to that of the marker // this will adapt automatically to P3D or OPENGL renderers nya.markers[i].beginTransform();
Oh, and there are 2 classes for texts and background label, but I think it's not related so i don't include them.
Thanks very much in advance! (and sorry for my bad english)