changeset 558:b05bae017029

boss1_action
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Thu, 22 Oct 2009 18:38:07 +0900
parents ec72b601b71f
children ccb33e5bcf89
files Renderer/Engine/SceneGraphRoot.cc Renderer/Engine/SceneGraphRoot.h Renderer/Engine/viewer.cc Renderer/Engine/viewer.h Renderer/Test/Makefile Renderer/Test/Makefile.macosx Renderer/Test/boss1_action.cc
diffstat 7 files changed, 82 insertions(+), 85 deletions(-) [+]
line wrap: on
line diff
--- a/Renderer/Engine/SceneGraphRoot.cc	Thu Oct 22 17:34:12 2009 +0900
+++ b/Renderer/Engine/SceneGraphRoot.cc	Thu Oct 22 18:38:07 2009 +0900
@@ -10,6 +10,8 @@
 
 static int cnt = 0;
 
+SceneGraphRoot *sgroot;
+
 #define SGLIST_INIT_LENGTH 128
 
 SceneGraphRoot::SceneGraphRoot(float w, float h)
@@ -29,6 +31,7 @@
     //   今はとりあえず camera を Root にしています
     //   今はそれすらもしてません
     //sg_exec_tree = camera;
+    sgroot = this;
 }
 
 SceneGraphRoot::~SceneGraphRoot()
--- a/Renderer/Engine/SceneGraphRoot.h	Thu Oct 22 17:34:12 2009 +0900
+++ b/Renderer/Engine/SceneGraphRoot.h	Thu Oct 22 18:38:07 2009 +0900
@@ -10,7 +10,7 @@
 public:
     /* Constructor, Destructor */
     SceneGraphRoot(float w, float h);
-    ~SceneGraphRoot(void);
+    ~SceneGraphRoot();
 
     /* Variables */
     // xml から読み込んだ、オリジナルの SceneGraph
@@ -49,19 +49,19 @@
     /* User API */
     void createFromXMLfile(TaskManager *manager, const char *);
     SceneGraphPtr createSceneGraph(int id);
-    SceneGraphPtr createSceneGraph(void);
+    SceneGraphPtr createSceneGraph();
     void setSceneData(SceneGraphPtr sg);
-    Pad *getController(void);
-    SceneGraphIteratorPtr getIterator(void);
+    Pad *getController();
+    SceneGraphIteratorPtr getIterator();
     SceneGraphIteratorPtr getIterator(SceneGraphPtr list);
-    CameraPtr getCamera(void);
+    CameraPtr getCamera();
 
     /* Other System API */
     void allExecute(int screen_w, int screen_h);
-    void checkRemove(void);
-    SceneGraphPtr getExecuteSceneGraph(void);
-    SceneGraphPtr getDrawSceneGraph(void);
-    void updateControllerState(void);
+    void checkRemove();
+    SceneGraphPtr getExecuteSceneGraph();
+    SceneGraphPtr getDrawSceneGraph();
+    void updateControllerState();
 
     void speExecute(int screen_w, int screen_h);
 
@@ -76,5 +76,7 @@
 #endif
 
 // 大域変数は無くすこと
+// move に Controller を渡せば必要ないはず...
 extern SceneGraphRootPtr sgroot;
-extern SceneGraphRootPtr sgroot_2;
+
+/* end */
--- a/Renderer/Engine/viewer.cc	Thu Oct 22 17:34:12 2009 +0900
+++ b/Renderer/Engine/viewer.cc	Thu Oct 22 18:38:07 2009 +0900
@@ -27,7 +27,6 @@
 //static void post2exchange_sgroot(void *viewer);
 //static void post2speRunLoop(void *viewer);
 
-SceneGraphRootPtr sgroot;
 //SceneGraphRootPtr sgroot_2;
 
 /* Data Pack sent to Other CPUs (ex. SPE) */
@@ -91,6 +90,7 @@
     SDL_GL_SwapBuffers();
 }
 
+/*
 void 
 Viewer::createFromXMLfile(const char *file) 
 {
@@ -103,11 +103,18 @@
     return sgroot->createSceneGraph(id);
 }
 
+SceneGraph *
+Viewer::createSceneGraph()
+{
+    return sgroot->createSceneGraph();
+}
+
 void
 Viewer::setSceneData(SceneGraph *g)
 {
     sgroot->setSceneData(g);
 }
+ */
 
 void
 Viewer::run_init(TaskManager *manager, Application *app)
--- a/Renderer/Engine/viewer.h	Thu Oct 22 17:34:12 2009 +0900
+++ b/Renderer/Engine/viewer.h	Thu Oct 22 18:38:07 2009 +0900
@@ -8,6 +8,7 @@
 #include "KeyStat.h"
 #include "MainLoop.h"
 #include "Application.h"
+#include "SceneGraphRoot.h"
 
 class Application;
 
@@ -36,6 +37,8 @@
     Uint32 video_flags;
     Uint32 *pixels;
 
+    SceneGraphRoot *sgroot;
+
     virtual void video_init(TaskManager *manager) = 0;
     void init();
 
@@ -63,11 +66,34 @@
     void getKey();
     void get_send_controll();
 
-    void createFromXMLfile(const char *file);
-    SceneGraph *createSceneGraph(int id);
-    void setSceneData(SceneGraph *g);
+    // void createFromXMLfile(const char *file);
+    // SceneGraph *createSceneGraph(int id);
+    // SceneGraph *createSceneGraph();
+    // void setSceneData(SceneGraph *g);
     void mainLoop();
 
+    void createFromXMLfile(const char *file)
+    {
+	sgroot->createFromXMLfile(manager, file);
+    }
+
+    SceneGraph * createSceneGraph(int id)
+    {
+	return sgroot->createSceneGraph(id);
+    }
+
+    SceneGraph * createSceneGraph()
+    {
+	return sgroot->createSceneGraph();
+    }
+
+    void setSceneData(SceneGraph *g)
+    {
+	sgroot->setSceneData(g);
+    }
+
+
+
 private:
     HTaskPtr initLoop();
     void speLoop();
--- a/Renderer/Test/Makefile	Thu Oct 22 17:34:12 2009 +0900
+++ b/Renderer/Test/Makefile	Thu Oct 22 18:38:07 2009 +0900
@@ -1,45 +1,10 @@
-include ./Makefile.def
 
-LIBS += -lFifoManager -lCerium
-
-CFLAGS += `sdl-config --cflags` `xml2-config --cflags`
-LIBS   += `sdl-config --libs` `xml2-config --libs` -lSDL_image -Wl,-framework,OpenGL
-
-.SUFFIXES: .cc .o .xml
-
-.cc.o:
-	$(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@
-
-all: ball_bound
+all: 
+	make -f Makefile.macosx
 
 cell:
 	make -f Makefile.cell
 
-BALL_BOUND_OBJ = ball_bound.o
-BALL_BOUND_XML = xml_file/Ball.xml
-
-ball_bound : $(BALL_BOUND_OBJ) $(BALL_BOUND_XML).o 
-	$(CC) -o $@ $< $(BALL_BOUND_XML).o  $(LIBS)
-
-ball_bound.cc : $(BALL_BOUND_XML).h 
-
-$(BALL_BOUND_XML).cc $(BALL_BOUND_XML).h : $(BALL_BOUND_XML)
-	perl $(TOOL)/create_sglist.pl -o $@ $(BALL_BOUND_XML)
-
-
-run: $(TARGET)
-	sudo ./$(TARGET) -width 576 -height 384 -bpp 32
-
-debug: $(TARGET)
-	sudo ppu-gdb ./$(TARGET) 
-
-depend:
-	$(RM) depend.inc
-	$(CC) -MM -MG $(INCLUDE) $(CFLAGS) $(SRCS) $(TASK_SRCS) > depend.inc
-
 clean:
-	rm -f $(TARGET) $(OBJS) $(TASK_OBJS) *.o
-	rm -f *~ \#*
-	rm -f $(BALL_BOUND_XML).cc $(BALL_BOUND_XML).h $(BALL_BOUND_OBJ)
-
--include depend.inc
+	make -f Makefile.macosx clean
+	make -f Makefile.cell clean
--- a/Renderer/Test/Makefile.macosx	Thu Oct 22 17:34:12 2009 +0900
+++ b/Renderer/Test/Makefile.macosx	Thu Oct 22 18:38:07 2009 +0900
@@ -1,40 +1,33 @@
 include ./Makefile.def
 
-SRCS_TMP = $(wildcard *.cc) $(wildcard Application/*.cc)
-SRCS_EXCLUDE =  # 
-SRCS = $(filter-out $(SRCS_EXCLUDE),$(SRCS_TMP))
-OBJS = $(SRCS:.cc=.o)
-
-TASK_DIR  = task
-TASK_SRCS_TMP = $(wildcard $(TASK_DIR)/*.cc)
-TASK_SRCS_EXCLUDE = span_pack_draw.cc
-TASK_SRCS = $(filter-out $(TASK_SRCS_EXCLUDE),$(TASK_SRCS_TMP))
-TASK_OBJS = $(TASK_SRCS:.cc=.o)
-
-LIBS += -lFifoManager
+LIBS += -lFifoManager -lCerium
 
 CFLAGS += `sdl-config --cflags` `xml2-config --cflags`
 LIBS   += `sdl-config --libs` `xml2-config --libs` -lSDL_image -Wl,-framework,OpenGL
 
-.SUFFIXES: .cc .o
+.SUFFIXES: .cc .o  .xml .xml.h
 
 .cc.o:
 	$(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@
 
-all: $(TARGET)
+all: ball_bound boss1_action
 
-$(TARGET) : $(OBJS) $(TASK_OBJS)
-	$(AR) crus $@ $(OBJS) $(TASK_OBJS) 
 
-# SGList.o: create_sg_list
-# 	$(CC) $(CFLAGS) $(INCLUDE) -c SGList.cc -o $@
+BALL_BOUND_OBJ = ball_bound.o
+BALL_BOUND_XML = xml_file/Ball.xml
+ball_bound : $(BALL_BOUND_OBJ) $(BALL_BOUND_XML).o 
+	$(CC) -o $@ $< $(BALL_BOUND_XML).o  $(LIBS)
+ball_bound.cc : $(BALL_BOUND_XML).h 
+$(BALL_BOUND_XML).cc $(BALL_BOUND_XML).h : $(BALL_BOUND_XML)
+	perl $(TOOL)/create_sglist.pl -o $@ $(BALL_BOUND_XML)
 
-create_sg_list:
-	@if [ ! -f SGList.h ]; then \
-		cd tools/;\
-		./create_sglist.pl ../xml_file/*.xml;\
-	fi
-
+BOSS_OBJ = boss1_action.o
+BOSS_XML = xml_file/boss1.xml xml_file/player1.xml xml_file/p_shot.xml xml_file/blast.xml
+boss1_action : $(BOSS_OBJ) xml_file/boss1.xml.o
+	$(CC) -o $@ $<  xml_file/boss1.xml.o $(LIBS)
+boss1_action.cc : xml_file/boss1.xml.h
+xml_file/boss1.xml.h xml_file/boss1.xml.cc : $(BOSS_XML)
+	perl $(TOOL)/create_sglist.pl -o $@ $(BOSS_XML) 
 
 run: $(TARGET)
 	sudo ./$(TARGET) -width 576 -height 384 -bpp 32
@@ -47,8 +40,8 @@
 	$(CC) -MM -MG $(INCLUDE) $(CFLAGS) $(SRCS) $(TASK_SRCS) > depend.inc
 
 clean:
-	rm -f $(TARGET) $(OBJS) $(TASK_OBJS)
+	rm -f $(TARGET) $(OBJS) $(TASK_OBJS) *.o
 	rm -f *~ \#*
-	rm -f SGList.h SGList.cc
+	rm -f $(BALL_BOUND_XML).cc $(BALL_BOUND_XML).h $(BALL_BOUND_OBJ)
 
 -include depend.inc
--- a/Renderer/Test/boss1_action.cc	Thu Oct 22 17:34:12 2009 +0900
+++ b/Renderer/Test/boss1_action.cc	Thu Oct 22 18:38:07 2009 +0900
@@ -1,6 +1,7 @@
 #include "SceneGraphRoot.h"
 #include "MainLoop.h"
 #include "boss1_action.h"
+#include "xml_file/boss1.xml.h"
 
 /*
 static void
@@ -205,7 +206,7 @@
 
 extern Application *
 application() {
-    return new ball_bound();
+    return new boss1_action();
 }
 
 const char *usr_help_str = "Usage: ./test_nogl [OPTION]\n";
@@ -233,13 +234,13 @@
 }
   
 MainLoopPtr
-bass1_action::boss1_init(Viewer *sgroot, int screen_w, int screen_h)
+boss1_action::init(Viewer *sgroot, int screen_w, int screen_h)
 {
 
-  sgroot->createFromXMLfile(manager, "xml_file/boss1.xml");
-  sgroot->createFromXMLfile(manager, "xml_file/player1.xml");
-  sgroot->createFromXMLfile(manager, "xml_file/p_shot.xml");
-  sgroot->createFromXMLfile(manager, "xml_file/blast.xml");
+  sgroot->createFromXMLfile("xml_file/boss1.xml");
+  sgroot->createFromXMLfile("xml_file/player1.xml");
+  sgroot->createFromXMLfile("xml_file/p_shot.xml");
+  sgroot->createFromXMLfile("xml_file/blast.xml");
   
   //rootとなるSceneGraphを生成
   SceneGraphPtr root = sgroot->createSceneGraph();