1 / 3

3D Game Programming Homework Assignment # 2

3D Game Programming Homework Assignment # 2 Write a program to hit test the 3D position on 3D objects. The scene data (in the HW02 folder) : test_scene.cwn In the same folder, there are the associated texture files. Requirements :

moshe
Download Presentation

3D Game Programming Homework Assignment # 2

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 3D Game Programming Homework Assignment # 2 • Write a program to hit test the 3D position on 3D objects. • The scene data (in the HW02 folder) : test_scene.cwn • In the same folder, there are the associated texture files. • Requirements : • Show camera current position, facing direction, and up direction on screen. • Press and hold the SHIFT key to use the mouse button to hit test any point on a 3D model object. • Show the hitting result on screen, including the hit object name and the 3D position. Just the demo program showed on screen. • A to-be-finished reference example (in src folder) : HomeWork02.cpp • Deadline : 1128/2005

  2. Hints : • To load a scene file, please use the scene.Load(). For example, • // query the number of objects in a scene file (.cwn) • numObj = scene.QueryObjectNumberInFile("test_scene"); • // load the scene and query all loaded objects • objID = (OBJECTid *)malloc(sizeof(OBJECTid)*numObj); • scene.Load("test_scene", objID); • 2. To show messages on screen : • // start to show message • FnWorld gw; • gw.Object(gID); • gw.StartMessageDisplay(); • // show messages • gw.MessageOnScreen(20, 15, string1, 255, 0, 0); • gw.MessageOnScreen(20, 30, string2, 255, 0, 0); • … • // finish the message displaying • gw.FinishMessageDisplay();

  3. 3. To hit test a 3D object, use the member function of a viewport function : FnViewport::HitPosition(obj_to_be_Hit, cam_ID, screenX, screenY, result) 4. To make sure the hit result is nearest to the camera, you need to check the distance between the hit point and the camera. Compared the hit result for each object to make sure the final result is nearest one.

More Related