[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    playground/games/kolf-ng
From:       Huan Zeng <zh.issac () gmail ! com>
Date:       2009-06-25 8:08:20
Message-ID: 1245917300.699807.26152.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 986841 by hzeng:

test for gravity, found some problems.
1)Simply set gravity using dWorldSetGravity() may cause segment fault, I guess this \
was caused by ODE's collision detection while the objects did not exist any more. \
2)And it seems that the ball didn't collide with the terrain, the ball just fell \
through the terrain. 3)I implemented the paint() function in EnvironmentObject, but \
the painting effect can be erased by other objects.


 M  +8 -10     courses/test1-terrain.kolf  
 M  +4 -0      elements/geometry-terrain.cpp  
 M  +1 -1      elements/object-environment.cpp  
 M  +1 -0      elements/scene.cpp  


--- trunk/playground/games/kolf-ng/courses/test1-terrain.kolf #986840:986841
@@ -8,29 +8,27 @@
 Par=2
 
 [Hole 1][Object 1]
-Type=Kolf::HoleObject
-Position=700,900,0
-
-[Hole 1][Object 2]
 Type=Kolf::EnvironmentObject
-CourseBoundary=false
+CourseBoundary=true
 PathToHeightmap=test1-heightmap.bmp
 PathToTexture=test1-texture.bmp
-Position=0,0,0
+Position=500,500,400
 
+[Hole 1][Object 2]
+Type=Kolf::HoleObject
+Position=700,900,0
 
 [Hole 2]
 ObjectCount=2
 Par=2
 
 [Hole 2][Object 1]
-Type=Kolf::HoleObject
-Position=700,500,0
-
-[Hole 2][Object 2]
 Type=Kolf::EnvironmentObject
 CourseBoundary=false
 PathToHeightmap=test1-heightmap.bmp
 PathToTexture=grass_256.jpg
 Position=0,0,0
 
+[Hole 2][Object 2]
+Type=Kolf::HoleObject
+Position=700,500,0
--- trunk/playground/games/kolf-ng/elements/geometry-terrain.cpp #986840:986841
@@ -69,6 +69,8 @@
 {
 	//TODO: how about heightmap reloaded
 	const QString fileName = KStandardDirs::locate("data", \
Kolf::HeightmapFileNamePattern.arg(pathToHeightmap)); +	if(fileName.isEmpty())
+		return;
 	m_heightmap = new Kolf::Heightmap(fileName);
 	m_vertices.clear();
 	m_textureIndices.clear();
@@ -92,6 +94,8 @@
 void Kolf::TerrainGeometry::setTexture(const QString& pathToTexture)
 {
 	const QString fileName = KStandardDirs::locate("data", \
Kolf::TextureFileNamePattern.arg(pathToTexture)); +	if(fileName.isEmpty())
+		return;
 	m_texture = new Kolf::Texture(fileName);
 	m_textureData.clear(); 
 	textureComputed = false;
--- trunk/playground/games/kolf-ng/elements/object-environment.cpp #986840:986841
@@ -170,6 +170,6 @@
 	m_item = m_geometry->picture();
 	if(!m_item)
 		return;
-	painter->drawPicture(0, 0, *m_item);
+	painter->drawPicture(-position().rx(), -position().ry(), *m_item);
 }
 #include "object-environment.moc"
--- trunk/playground/games/kolf-ng/elements/scene.cpp #986840:986841
@@ -44,6 +44,7 @@
 //	, m_updateTimerID(-1) //uncomment this line (and comment out the above one) to \
disable the physics engine  {
 	//TODO: activate gravity when the landscape object is added
+	//dWorldSetGravity(m_worldID, 0.0, 0.0, -9.8);
 }
 
 Kolf::Scene::~Scene()


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic