Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Hobnob
Feb 23, 2006

Ursa Adorandum
Say the coordinates of your point in world space are given by the vector P, and it has an orientation vector n.

I'm not sure what exactly what you mean by "draw a rectangle around it" but I'll assume you want the rectangle in a plane perpendicular to n. You'll also need an "up" direction perpendicular to n to orient the rectangle - we'll say that's u. If you don't have an "up" direction already we could calculate that based on the closest axis, but for now I'll assuming you have one.

For ease, we'll assume that both n and u are normalized: |n| = |u| = 1.

You can calculate a "right" direction vector from a cross product:
r = n x u

Now r and u are the basis vectors of a set of local x-y coordinates in the plane of your rectangle.

Then for a rectangle of size w x h, the positions of the four corners (in world space) are:

C1 = P + hu + wr
C2 = P + hu - wr
C3 = P - hu - wr
C4 = P - hu + wr

I hope that's helpful.

Hobnob fucked around with this message at 17:48 on Sep 11, 2009

Adbot
ADBOT LOVES YOU

Hobnob
Feb 23, 2006

Ursa Adorandum

Unparagoned posted:

I'm using opengles. I have my world or (flat board) that's all good. But the background is black. Is there a way to make the default emptiness a different color?

In regular OpenGL this is set by glClearColor(R,G,B,A) - I don't think it will be any different in ES.

Hobnob
Feb 23, 2006

Ursa Adorandum

PDP-1 posted:

Are there any tips or tricks for debugging shader files?

I'm using DirectX/HLSL and finding writing custom shaders to be very frustrating since it isn't possible to step through the code like you can in a normal IDE and there's no way to print values to a debug file.

Are there any kind of emulators that will take a .fx file as input, let you specify the extern values and vertex declaration, and walk through the code one line at a time?

I don't think it will let you single-step, but Rendermonkey is useful for developing shaders. You can tweak inputs, see intermediate and final outputs, and tweak the shader code very easily.

Hobnob
Feb 23, 2006

Ursa Adorandum
Maybe I'm missing something, but why not translate so that the tip of bone 3 is the origin (in the 'bind pose' - so that would be (L3*L2*L1)^-1 ), then perform the standard transform L3*R3*L2*R2*L1*R1?

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply