annotate Renderer/Engine/Light.cc @ 801:eb6add789a24 draft

global id
author yutaka@localhost.localdomain
date Wed, 19 May 2010 14:59:41 +0900
parents 6e9e4726113e
children 294bc9364bee
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
597
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
1 #include <math.h>
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
2 #include "SceneGraphRoot.h"
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
3 #include "Light.h"
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
4 #include "sys.h"
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
5 #include "Scheduler.h"
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
6 #include "TaskManager.h"
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
7
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
8 static void
653
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 597
diff changeset
9 light_move(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h)
597
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
10 {
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
11
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
12 }
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
13
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
14 static void
653
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 597
diff changeset
15 light_collision(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h,
597
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
16 SceneGraphPtr tree)
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
17 {
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
18 }
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
19
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
20 /**
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
21 * @param w Width of screen
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
22 * @param h Height of screen
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
23 */
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
24 Light::Light(float w, float h)
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
25 {
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
26 name = (char*)"Light";
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
27
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
28 // Screen の真ん中を初期値とする
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
29 xyz[0] = w/2.0f;
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
30 xyz[1] = h/2.0f;
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
31 xyz[2] = 0;
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
32 xyz[3] = 1.0f;
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
33
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
34 this->set_move_collision(light_move, light_collision);
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
35 }
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
36
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
37 Light::~Light(void)
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
38 {
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
39
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
40 }
1bfa45a08fa7 add Light Object
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
41