|
2 registered members (alibaba, vince),
2,781
guests, and 8
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
vec_for_screen broken in A8
#402678
06/09/12 00:25
06/09/12 00:25
|
Joined: Jun 2004
Posts: 655 to your left
BoH_Havoc
OP
User
|
OP
User
Joined: Jun 2004
Posts: 655
to your left
|
Thanks to the user rojart i finally got myself an upgrade to A8 Pro (thanks!). While testing Shade-C with A8 i found something strange. It seems that vec_for_screen is broken in A8. Just try this simple script
void main()
{
level_load(NULL);
wait(5);
while(1)
{
VECTOR testVec;
testVec.x = 0;
testVec.y = 0;
testVec.z = -10000;
vec_for_screen(testVec, camera);
vec_set(testVec, vector(testVec.x, testVec.z, testVec.y) );
DEBUG_VAR(testVec.x,screen_size.y-40);
wait(1);
}
}
A7 outputs -9999 (correct) A8 outputs -8202.271 (incorrect) I need correct values for vec_for_screen, as i'm reconstructing worldspace and viewspace position in some shaders using a depthmap and 4 values vec_for_screen gives me. (more info here http://mynameismjp.wordpress.com/2009/05/05/reconstructing-position-from-depth-continued/ ) Can you confirm this bug?
|
|
|
Re: vec_for_screen broken in A8
[Re: BoH_Havoc]
#403391
06/19/12 09:55
06/19/12 09:55
|
Joined: Jun 2006
Posts: 2,640 Earth
Germanunkol
Expert
|
Expert
Joined: Jun 2006
Posts: 2,640
Earth
|
Have you tried different mouse_modes? I believe something changed with the mouse modes...
Edit: Scratch that. The mouse modes were right in my application. But for some reason I can't get mouse_ent to work any more. Might be unrelated though. But mine is not an engine bug.
Last edited by Germanunkol; 06/19/12 10:11.
~"I never let school interfere with my education"~ -Mark Twain
|
|
|
Re: vec_for_screen broken in A8
[Re: BoH_Havoc]
#403421
06/19/12 20:16
06/19/12 20:16
|
Joined: Sep 2003
Posts: 5,900 Bielefeld, Germany
Pappenheimer
Senior Expert
|
Senior Expert
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
|
Does this help?
mouse_pos3d
The world coordinate position of the mouse cursor in relation to the 3D level, calculated from mouse_pos and the view parameters. Type: VECTOR*, read/only Example:
// use the mouse to trace a ray into the level, // and trigger EVENT_SHOOT of hit entities function shoot_with_mouse() { VECTOR to; vec_set(to,mouse_dir3d); vec_scale(to,1000); // set a range vec_add(to,mouse_pos3d); c_trace(mouse_pos3d,to,ACTIVATE_SHOOT);
|
|
|
Re: vec_for_screen broken in A8
[Re: jcl]
#403460
06/20/12 15:10
06/20/12 15:10
|
Joined: Jun 2004
Posts: 655 to your left
BoH_Havoc
OP
User
|
OP
User
Joined: Jun 2004
Posts: 655
to your left
|
Thanks for looking into it jcl! I don't understand why -9999 is wrong though. If the camera's pan/tilt/roll values are all zero (= camera looking in X axis direction) and i give vec_for_screen a point which should be 10000 quants in front of the camera, how can the resulting point not be 10000/9999 quants aways but rather be something crude like 8202 ? It makes even less sense the longer i think about it  Plus the position reconstruction in the shader gives wrong results (the shader should be correct as i'm using it in another engine, too). Also, for the reconstruction i always need the most far away points of the view frustum (basically the far frustum edges). So if camera.clip_far = 10000 i should get points which are 10000(or 9999) quants away from the camera. Instead i get 8202. I'll try to create a workaround and directly fetch the far frustum corners instead of using vec_for_screen and compare that to what vec_for_screen outputs. Directly fetching/calculating the far frustum points should be faster anyway 
Last edited by BoH_Havoc; 06/20/12 15:10.
|
|
|
|