Author Topic: The armor thingy  (Read 3999 times)

0 Members and 1 Guest are viewing this topic.

Offline WMCoolmon

  • Purveyor of space crack
  • 213
Er, sure, that'd be great. :D

I don't know if my current armor system revision is working yet, though, and haven't set up expressions (I started to, but realized that I need to learn how everything works in order to get things working properly.)

I did have a thought today, we should maybe have some way to differentiate between table-specifc values and globally available values. I was thinking maybe a "g." prefix for all global variables, but, hmm. I'm going to sleep on it.
-C

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
I = input vector
N = normal of surface
R = output reflection vector

||I||=||N||=||R||=1 (there all unit length, ie normalized)
I, R, and N are coplaner

I•N = -R•N

-I+R=N

(-I)+R =  N

(-I+R)•N = N•N =

(-I•N)+(N•R) =

(-I•N)+(-I•N) =

2(-I•N) =  

-I + R = N = 2(-I•N)N



tada-> "R = 2(-I•N)N + I "

so to code that would be (remembering parameters off top of head)

void vm_vec_reflect(vector*out, vector*norm,vector*in){
float d= -2*vm_vec_dot(in,norm);
vm_vec_scale(out,norm,d); //assumeing (dest,src,float)
vm_vec_add2(out,in);
}
« Last Edit: May 03, 2005, 02:26:50 am by 57 »
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together