remixlab / proscene

Processing library for the creation of interactive scenes

Home Page:http://nakednous.github.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PShape mode CENTER fucks iFrame position

Diex opened this issue · comments

commented

si no haces esto, el frame se te vuela de la pantalla si usas modo CENTER.

esto es usando

frame.setShape(ps);
pgraphics.shapeMode(CENTER);
frame.draw(pgraphics);

si en Shape.java haces:

26: shp.draw(pg); // needs to handle recorder too
27: if (pg.shapeMode == PApplet.CENTER) {
28: // Si no haces esto, la transformación se te acumula
29: iFrame.translate(shp.getWidth() / 2, shp.getHeight() / 2);
30: pg.popMatrix();
31: }
32: }

commented

silly me (silly you maybe) :)
I think you should do:

File:
20: pg.flush();
21: if (pg.shapeMode == PApplet.CENTER) {
22: pg.pushMatrix();
23: // iFrame.translate(-shp.getWidth() / 2, -shp.getHeight() / 2);
24: pg.translate(-shp.getWidth() / 2, -shp.getHeight() / 2);
25: }
26:

Thanks for reporting it. I just pushed the fix. Please confirm that it's working now.

commented

hey ! nice to see you...
No, actually yes but it fucks the picking mechanism. frame picking occurs when your mouse is w/2, h/2 in the oposite direction (ie: as it is rendered I think as CORNER - default behaviour)
by the way: what "android" src I need to add to my buildPath in order to avoid:

  defMotionAgent = new DroidTouchAgent(this); // DroidTouchAgent cannot be resolved... blabla

I was using a former commit (no android at all)

kind regards !
dx

hmmh picking uses the color of the picking buffer so I don't see how it's related. Could you please provide a little example reproducing the issue? In the mean time you can try frame.center() (which can also be bound to a key shortcut)

To set up the eclipse project for android:

  1. Download the android mode from your pde. It will land to sketchbook/modes/AndroidMode
  2. In eclipse set up an ANDROID_LIB variable pointing to: sketchbook/modes/AndroidMode/sdk/platforms/android-23/android.jar

nice to see you too ;)

commented

I'll try but it is a huge eclipse project I'm working on. but I should try cause maybe my code is doing wrong.

mtf!!! Error during download and install of Android Mode.
:)

commented

done. but still doing wrong picking. how does actually picking works? (briefly)

commented

check this out (give it a couple minutes to process):
https://www.youtube.com/watch?v=soG3m3vb4e4

using scene.setPickingVisualHint(true); seems to work but picking does not.

I'm not familiar with shape CENTER mode, but did you try to set it for the iFrame.pickingShape too?

commented

what do you mean?

when I create it I do (in a InteractiveFrame subclass):
{
super(scn);
setPosition(pos.x, pos.y, pos.z);
removeBindings();
setMotionBinding(MouseAgent.LEFT_ID, "translate");
PShape ps = scn.pApplet().loadShape("cross.svg");
setPickingShape(ps);
setFrontShape(ps);
}

then for drawing:
pgraphics.shapeMode(CENTER);
iframe.draw(pgraphics);

commented

I cant find where the picking buffer is updated or where the
"scene().unchachedBuffer = true;" is then cached again...

commented

got it:
scene.pickingBuffer().shapeMode(PApplet.CENTER);

extremely fucking weird buddy !!! :)
(let me know if annoys you me using the f word.)

un abrazo !
dx