[Orxonox-commit 7045] r11664 - in code/branches/AsteroidMining_HS17: data/levels src/modules/asteroidmining
remartin at orxonox.net
remartin at orxonox.net
Mon Dec 11 18:05:17 CET 2017
Author: remartin
Date: 2017-12-11 18:05:17 +0100 (Mon, 11 Dec 2017)
New Revision: 11664
Modified:
code/branches/AsteroidMining_HS17/data/levels/AsteroidFarming.oxw
code/branches/AsteroidMining_HS17/src/modules/asteroidmining/AsteroidMinable.cc
code/branches/AsteroidMining_HS17/src/modules/asteroidmining/AsteroidMinable.h
code/branches/AsteroidMining_HS17/src/modules/asteroidmining/CMakeLists.txt
code/branches/AsteroidMining_HS17/src/modules/asteroidmining/SpicedAsteroidField.cc
code/branches/AsteroidMining_HS17/src/modules/asteroidmining/SpicedAsteroidField.h
Log:
SpicedAsteroidBelt erstellt, kosmetische Veranderungen. Offener Punkt um velocity, ansonsten fehlt nur noch das dokumentieren.
Modified: code/branches/AsteroidMining_HS17/data/levels/AsteroidFarming.oxw
===================================================================
--- code/branches/AsteroidMining_HS17/data/levels/AsteroidFarming.oxw 2017-12-11 16:39:48 UTC (rev 11663)
+++ code/branches/AsteroidMining_HS17/data/levels/AsteroidFarming.oxw 2017-12-11 17:05:17 UTC (rev 11664)
@@ -17,8 +17,10 @@
include("templates/pickupRepresentationTemplates.oxt")
?>
+
<WorldAmbientSound source="Asteroid_rocks.ogg" looping="true" playOnLoad="true" />
+
<Level>
<templates>
<Template link=lodtemplate_default />
@@ -32,6 +34,7 @@
hasPhysics = true
>
+
<?lua
include("includes/pickups.oxi")
?>
@@ -101,10 +104,40 @@
<AsteroidMinable size=50 position="500,-500, 500" />
<AsteroidMinable size=30 position="-100, -500, -100" velocity= "0, -30, 0"/>
- <!--- SpicedAsteroidField --->
- <SpicedAsteroidField count=30 mDensity= 0.5 maxSize=40 minSize=1 position="5000, 0, 0" radius=1000/>
+ <!--- SpicedAsteroidField -->
+ <SpicedAsteroidField count=30 mDensity= 0.5 maxSize=40 minSize=1 position="5000, 0, 0" radius=1000 velocity="-100,0,0"/>
+ <!-- Asteroid Belt with a planet -->
+ <SpicedAsteroidBelt position="-15000,0,0" mDensity=0.3 yaw=90 pitch=90 roll=90 segments=30 minSize=1 maxSize=50 radius0=7190 radius1 = 7800 count=250/>
+ <Planet
+ position="-15000,0,0"
+ scale="5000"
+ collisionType="dynamic"
+ linearDamping="0.8"
+ angularDamping="0"
+ mass="10000000"
+ pitch="0"
+ mesh="planets/muunilinst.mesh"
+ atmosphere="atmosphere1"
+ rotationaxis="1,0,0"
+ rotationrate="1.0"
+ atmospheresize="80.0f"
+ imagesize="1024.0f"
+ collisiondamage = 2
+ enablecollisiondamage = true
+ >
+ <attached>
+ <ForceField position="5000,0,0" mode="sphere" diameter="10000" velocity="-50" />
+ </attached>
+ <collisionShapes>
+ <SphereCollisionShape radius="5000" position="0,0,0" />
+ </collisionShapes>
+ </Planet>
+
+
+
+
</Scene>
</Level>
Modified: code/branches/AsteroidMining_HS17/src/modules/asteroidmining/AsteroidMinable.cc
===================================================================
--- code/branches/AsteroidMining_HS17/src/modules/asteroidmining/AsteroidMinable.cc 2017-12-11 16:39:48 UTC (rev 11663)
+++ code/branches/AsteroidMining_HS17/src/modules/asteroidmining/AsteroidMinable.cc 2017-12-11 17:05:17 UTC (rev 11664)
@@ -28,6 +28,8 @@
/*
+ @file AsteroidMinable.cc
+
*
*
* An asteroid which can be destroyed. Some smaller asteroids are created and a pickup
@@ -44,7 +46,9 @@
KNACKPUNKTE:
+o Super-XML-Argumente werden nicht richtig geparst (Velocity, Pitch, Yaw etc. )
+
OFFEN:
o Add custom pickup 'resources'. Weird template stuff -> Problems setting 'size' and other properties? setNumber of Resources.
@@ -57,15 +61,12 @@
o Anfangsgeschwindigkeit fuers Asteroidenfeld
o Density doesn't add up to 1...
o set collisionDamage? Just for static entities?
-o AsteroidBelt?
o Dokumentieren mit @brief?
o unregister -empty- asteroids from radar. (or turn them green or whatever)
o Add sound effect (crunching etc. ) (No sound in space...)
o Explosion parts
-o custom HUD
-
HANDBUCH:
o im Level-File includes/pickups.oxi importieren.
o Bei der XML-Variante wird beim ersten Aufruf der Tick-Methode ein neuer Asteroid generiert,
@@ -123,32 +124,15 @@
#include "network/NetworkFunction.h"
#include "util/Math.h"
-
-// #include "infos/PlayerInfo.h"
-// #include "controllers/Controller.h"
-// #include "gametypes/Gametype.h"
-// #include "graphics/ParticleSpawner.h"
-// #include "worldentities/ExplosionChunk.h"
-// #include "worldentities/ExplosionPart.h"
-
-// #include "core/object/ObjectListIterator.h"
-// #include "controllers/FormationController.h"
-
-#include "../pickup/items/HealthPickup.h"
#include "../pickup/PickupSpawner.h"
#include "../pickup/Pickup.h"
-//#include "../pickup/pickup ..... pickupable
+
#include "../objects/collisionshapes/SphereCollisionShape.h"
#include "../../orxonox/graphics/Model.h"
+namespace orxonox{
-
-
-
-
-namespace orxonox
-{
RegisterClass(AsteroidMinable);
// @brief Standard constructor
@@ -155,18 +139,25 @@
AsteroidMinable::AsteroidMinable(Context* context) : Pawn(context){
RegisterObject(AsteroidMinable);
-
this->context = context;
- this->initialised = false;
- this->dropStuff = true; // Default
+ // Default Values:
+ this->size = 10;
+ this->dropStuff = true;
+ this->generateSmaller = true;
+ this->health_ = 15*size;
+ this->maxHealth_ = this->health_;
+ this->acceptsPickups_ = false;
+
//Noetig, damit nicht sofort zerstoert?
this->setCollisionType(WorldEntity::CollisionType::Dynamic);
+ this->enableCollisionCallback();
+
// Old from Pawn
this->registerVariables();
- //orxout() << "AsteroidMining:: Pseudo-Konstruktor passiert!" << endl;
+ this->initialised = false;
}
@@ -183,10 +174,6 @@
// Somehow remove from radar?
}
- this->setCollisionType(WorldEntity::CollisionType::Dynamic);
- this->enableCollisionCallback();
-
- // Default Values
this->context = c;
this->size = size;
this->health_ = 15*size;
@@ -196,15 +183,17 @@
this->dropStuff = dropStuff;
this->setPosition(position);
- this->setVelocity(v); // velocity = v; // The right one?
- //this->roll = rand()*5; //etwas Drehung. richtige Variable
+ this->setVelocity(v);
+ //this->roll = rand()*5; //etwas Drehung. Richtige Variable?
+ this->setCollisionType(WorldEntity::CollisionType::Dynamic);
+ this->enableCollisionCallback();
- // Add Model //<Model position="0,-40,40" yaw="90" pitch="-90" roll="0" scale="4" mesh="ast6.mesh" />
+
+ // Add Model, random one of the 6 shapes
Model* hull = new Model(this->context);
- // random one of the 6 shapes
char meshThingy[] = "";
- sprintf(meshThingy, "ast%.0f.mesh", round(5*rnd())+1); // sprintf(str, "Value of Pi = %f", M_PI);
+ sprintf(meshThingy, "ast%.0f.mesh", round(5*rnd())+1);
hull->setMeshSource(meshThingy);
hull->setScale(this->size);
this->attach(hull);
@@ -211,65 +200,57 @@
// Collision shape
SphereCollisionShape* cs = new SphereCollisionShape(this->context);
- cs->setRadius((this->size)*2); //OFFEN: Feinabstimmung der Radien. 2.5 in AsteroidField.lua
+ cs->setRadius((this->size)*2); //OFFEN: Feinabstimmung der Radien.
this->attachCollisionShape(cs);
- // Old from Pawn
this->registerVariables();
this->initialised=true;
- //orxout() << "AsteroidMining:: Initialisierung Zweitkonstruktor abgeschlosssssen." << endl;
-
}
AsteroidMinable::~AsteroidMinable(){
}
+
// @brief Helper method. Create a new asteroid to have an appropriate size for the collision shape etc.
void AsteroidMinable::putStuff(){
// Just create a new asteroid to avoid Collision shape scale problems etc.
AsteroidMinable* reborn = new AsteroidMinable(this->context, this->size, this->getPosition(), this->getVelocity(), this->dropStuff);
- reborn->toggleShattering(true); // mainly here to avoid 'unused' warning.
+ (void)reborn; // avoid compiler warning
this->bAlive_ = false;
this->destroyLater();
- //this->~AsteroidMinable(); // seems dangerous, yields warning. Necessary for efficiency?
}
- void AsteroidMinable::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(AsteroidMinable, XMLPort, xmlelement, mode);
- // XMLPortParam(PickupSpawner, "pickup", setPickupTemplateName, getPickupTemplateName, xmlelement, mode);
+ void AsteroidMinable::XMLPort(Element& xmlelement, XMLPort::Mode mode){
+
+ SUPER(AsteroidMinable, XMLPort, xmlelement, mode);
+
XMLPortParam(AsteroidMinable, "size", setSize, getSize, xmlelement, mode);
+ XMLPortParam(AsteroidMinable, "generateSmaller", toggleShattering, doesShatter, xmlelement, mode);
+ XMLPortParam(AsteroidMinable, "dropStuff", toggleDropStuff, doesDropStuff, xmlelement, mode);
}
- void AsteroidMinable::XMLEventPort(Element& xmlelement, XMLPort::Mode mode)
- {
+ void AsteroidMinable::XMLEventPort(Element& xmlelement, XMLPort::Mode mode){
+
SUPER(AsteroidMinable, XMLEventPort, xmlelement, mode);
- XMLPortEventState(AsteroidMinable, BaseObject, "vulnerability", setVulnerable, xmlelement, mode);
}
- void AsteroidMinable::registerVariables()
- {
+ void AsteroidMinable::registerVariables(){
registerVariable(this->size, VariableDirection::ToClient);
registerVariable(this->generateSmaller, VariableDirection::ToClient);
-
+ registerVariable(this->dropStuff, VariableDirection::ToClient);
registerVariable(this->initialised, VariableDirection::ToClient);
- // float size;
- // bool generateSmaller;
- // bool initialised;
-
- // Context* context;
}
- void AsteroidMinable::tick(float dt)
- {
+ void AsteroidMinable::tick(float dt){
+
if(!(this->initialised)){this->putStuff();}
if(this->health_ <=0){this->death();}
@@ -276,17 +257,9 @@
}
+ void AsteroidMinable::death(){ // ueberschreibt das Zeug in Pawn
-
-
- void AsteroidMinable::death() //ueberschreiben
- {
-
- // orxout() << "AsteroidMinable::Death() aufgerufen." << endl;
-
- // OFFEN: Sauber kapputten
- // just copied other stuff:
- // this->setHealth(1);
+ // just copied that from somewhere else.
this->bAlive_ = false;
this->destroyLater();
this->setDestroyWhenPlayerLeft(false);
@@ -311,19 +284,15 @@
thingy->setMaxSpawnedItems(1); // Would be default anyways
thingy->setRespawnTime(0.2f);
}
- // orxout() << "AsteroidMining::Death(): Passed Pickup stuff!" << endl;
// Smaller Parts = 'Children'
if(this->generateSmaller){this->spawnChildren();}
- // orxout() << "Wieder retour in death() geschafft. " << endl;
-
}
void AsteroidMinable::spawnChildren(){// Spawn smaller Children
-
if (this->size <=1){return;} // Absicherung trivialer Fall
int massRem = this->size-1; //some mass is lost
@@ -330,15 +299,19 @@
int num = round(rnd()*(massRem-1)) + 1; // random number of children, at least one
if(num > 10){num = 10;} // no max function in C!
int masses[num]; // Masses of the asteroids, at least one.
- //orxout() << "SpawnChildren(): Passed basic stuff. num = " << num << "; massRem(total) = "<< massRem << endl;
+ // orxout() << "SpawnChildren(): Passed basic stuff. num = " << num << "; massRem(total) = "<< massRem << endl;
+
massRem = massRem-num; // mass is at least one, add again below.
// Randomnised spawning points for the new asteroids
- float phi[num]; // assuming that it gets initialised to 0. Add (= {0.0})?
- float theta[num];
+ float phi[num];
+ float theta[num];
+
+ // Discusting C stuff -> use that to initialise dynamic array values to 0.
+ for(int twat = 0; twat<num; ++twat){masses[twat] = 0; phi[twat] = 0.0; theta[twat] = 0.0;}
+
float piG = 3.1415927410125732421875; //pi; // Math.pi ist statisch oder so.
-
float d_p = 2*piG/num;
float d_t = piG/num;
float p = d_p/2.0;
@@ -346,6 +319,7 @@
// float phiOffset = rnd()*2*pi; // Added everywhere to become independent of the coordinate system?
// float thetaOffset = rnd()*pi;
float rScaling; // scale radius to prevent asteroids from touching. (distance=AsteroidRadius/tan(sector/2))
+
if(num == 1 ){
rScaling = 1; // avoid tan(90). Unused.
}else{
@@ -403,25 +377,18 @@
for(int trav = 0; trav<num; ++trav){
result = 0;// reset
rVal = rnd();// between 0 and 1
- // orxout() << "Random Value picked: " << rVal << endl;
probSum = probDensity[0];
- //orxout() << "Sum at start: " << probSum << endl;
- while(rVal>probSum && result<massRem){// Not yet found && there-s smth to distribute (Incrementing once inside!)
+ while(rVal>probSum && result<massRem){// Not yet found && there-s smth left to distribute (Incrementing once inside!)
if(result<(massRem-2)){probSum = probSum + probDensity[result+1];} // avoid logical/acess error
++result;
- // orxout() << "Sum so far: " << probSum << ". Just added " << probDensity[result+1] << endl;
}
massRem = massRem-result;
- masses[trav] = 1 +result; // at least one
- // orxout() << "Mass chosen for child " << trav << " is: " << masses[trav] << endl;
-
+ masses[trav] = 1 +result; // Fragments have mass of at least one.
}
- }else{// Everyone has mass 1. Initialising the array to 1 doesn-t seem to work. Hideous C language!
- for(int schnaegg = 0; schnaegg<num; ++schnaegg){
- masses[schnaegg] = 1;
- }
+ }else{
+ for(int schnaegg = 0; schnaegg<num; ++schnaegg){masses[schnaegg] = 1;}
}
// orxout() << "SpawnChildren(): Masses: "; printArrayString(masses);
@@ -436,7 +403,6 @@
pos = new Vector3(r*sin(theta[fisch])*cos(phi[fisch]), r*sin(theta[fisch])*sin(phi[fisch]), r*cos(theta[fisch])); // convert spheric coordinates to vector
}
- // orxout() << "Creating asteroid with mass " << masses[fisch] << " at relative postition " << *pos << endl;
AsteroidMinable* child = new AsteroidMinable(this->context, masses[fisch], this->getPosition() + *pos, this->getVelocity(), this->dropStuff);
if(child == nullptr){
Modified: code/branches/AsteroidMining_HS17/src/modules/asteroidmining/AsteroidMinable.h
===================================================================
--- code/branches/AsteroidMining_HS17/src/modules/asteroidmining/AsteroidMinable.h 2017-12-11 16:39:48 UTC (rev 11663)
+++ code/branches/AsteroidMining_HS17/src/modules/asteroidmining/AsteroidMinable.h 2017-12-11 17:05:17 UTC (rev 11664)
@@ -26,6 +26,13 @@
*
*/
+
+/**
+ @file AsteroidMinable.h
+
+
+*/
+
#ifndef _AsteroidMinable_H__
#define _AsteroidMinable_H__
@@ -63,9 +70,11 @@
inline int getSize(){return this->size;}
inline void toggleShattering(bool b){this->generateSmaller = b;}
+ inline bool doesShatter(){return this->generateSmaller;}
+
inline void toggleDropStuff(bool b){this->dropStuff = b;}
+ inline bool doesDropStuff(){return this->dropStuff;}
-
protected:
Context* context;
@@ -73,6 +82,7 @@
int size;
bool generateSmaller;
bool dropStuff;
+
bool initialised;
virtual void death();
Modified: code/branches/AsteroidMining_HS17/src/modules/asteroidmining/CMakeLists.txt
===================================================================
--- code/branches/AsteroidMining_HS17/src/modules/asteroidmining/CMakeLists.txt 2017-12-11 16:39:48 UTC (rev 11663)
+++ code/branches/AsteroidMining_HS17/src/modules/asteroidmining/CMakeLists.txt 2017-12-11 17:05:17 UTC (rev 11664)
@@ -1,6 +1,7 @@
SET_SOURCE_FILES(PICKUP_SRC_FILES
AsteroidMinable.cc
SpicedAsteroidField.cc
+ SpicedAsteroidBelt.cc
)
ORXONOX_ADD_LIBRARY(asteroidmining
Modified: code/branches/AsteroidMining_HS17/src/modules/asteroidmining/SpicedAsteroidField.cc
===================================================================
--- code/branches/AsteroidMining_HS17/src/modules/asteroidmining/SpicedAsteroidField.cc 2017-12-11 16:39:48 UTC (rev 11663)
+++ code/branches/AsteroidMining_HS17/src/modules/asteroidmining/SpicedAsteroidField.cc 2017-12-11 17:05:17 UTC (rev 11664)
@@ -26,21 +26,12 @@
*
*/
-/*
+/**
-*
-*
-*<OFFEN Describe
-Math from asteroidField.lua used.
-*
-*
+ @file SpicedAsteroidField.cc
+ @brief Asteroid field with lots of parameters. Derived from asteroidField.lua
-DESCRIPTION
-o Andere: Simpel wie in asteroidField.lua, oder einfach Asteroiden, die nichts abwerfen?
---> Letzteres scheint passender, simpler.
-
-
*/
@@ -59,49 +50,47 @@
#include "network/NetworkFunction.h"
#include "util/Math.h"
-// #include "infos/PlayerInfo.h"
-// #include "controllers/Controller.h"
-// #include "gametypes/Gametype.h"
-// #include "graphics/ParticleSpawner.h"
-// #include "worldentities/ExplosionChunk.h"
-// #include "worldentities/ExplosionPart.h"
+#include "../../orxonox/graphics/Billboard.h"
-// #include "core/object/ObjectListIterator.h"
-// #include "controllers/FormationController.h"
+namespace orxonox{
-//#include "../pickup/pickup ..... pickupable
-#include "../objects/collisionshapes/SphereCollisionShape.h"
-#include "../../orxonox/graphics/Model.h"
-
-
-
-
-
-
-namespace orxonox
-{
RegisterClass(SpicedAsteroidField);
SpicedAsteroidField::SpicedAsteroidField(Context* context) : Pawn(context) {
- // Da auch noetig? Wegen set in XML-Code?
RegisterObject(SpicedAsteroidField);
+ this->context = context;
- this->context = context;
+ // Default Values:
+ this->count = 30;
+ this->mDensity = 0.5;
+ this->position = Vector3(0,0,0);
+ this->maxSize = 40;
+ this->minSize = 1;
+ this->radius = 1000;
this->foggy = true;
this->fogDensity = 0.5;
- this->count = 0;
- // Old from Pawn
this->registerVariables();
+ }
+ SpicedAsteroidField::SpicedAsteroidField(Context* c, Vector3 p, int minS, int maxS, int w, int count, bool f, float mD, float fD): Pawn(c){
- // this->create();
- this->bAlive_ = false;
- this->destroyLater();
+ this->context = c;
+ this->position = p;
+ this->minSize = minS;
+ this->maxSize = maxS;
+ this->radius = w;
+ this->count = count;
+ this->foggy = f;
+
+ this->mDensity = mD;
+ this->fogDensity = fD;
+
}
+
SpicedAsteroidField::~SpicedAsteroidField(){
}
@@ -115,6 +104,7 @@
Vector3* relPos;
+
for(int gertrud = 0; gertrud<count; ++gertrud){
AsteroidMinable* a = new AsteroidMinable(this->context);
@@ -130,37 +120,25 @@
bool spiced = (rnd() < (this->mDensity)); // does drop pickups etc.
a->toggleDropStuff(spiced);
- // @TODO: Fox Fog stuff, error due to billbord
-
-// Billboard* bb;
-// if(this->foggy && mod(gertrud, 5) == 0){
-// bb = new Billboard(this->context);
-// bb->setPosition(this-position + *relPos);
-// bb->setMaterial("Smoke/Smoke");
-// bb->setScale(size); // tricky?
-
-// bb->setColour(ColourValue(this-fogDensity, this->fogDensity, this->fogDensity)); // 4rd argument = transparency?
-
-// // print("<Billboard ")
-// // print("position = \"")
-// // print(posX) print(",")
-// // print(posY) print(",")
-// // print(posZ) print("\" ")
-// // print("colour=\"")
-// // print(brightness) print(",")
-// // print(brightness) print(",")
-// // print(brightness) print("\" ")
-// // print("material=\"Smoke/Smoke\" scale=")
-// // print(size)
-// // print(" />")
-// }
+ // A problem
+ a->setVelocity(this->getVelocity());
+
+ // Fog is iplemented with billboards.
+ Billboard* bb;
+ if(this->foggy && mod(gertrud, 5) == 0){
+ bb = new Billboard(this->context);
+ bb->setPosition(this->position + *relPos);
+ bb->setMaterial("Smoke/Smoke");
+ bb->setScale(size);
+ bb->setColour(ColourValue(this->fogDensity, this->fogDensity, this->fogDensity));
+ }
}
}
- void SpicedAsteroidField::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- // SUPER(SpicedAsteroidField, XMLPort, xmlelement, mode);
- // XMLPortParam(PickupSpawner, "pickup", setPickupTemplateName, getPickupTemplateName, xmlelement, mode);
+ void SpicedAsteroidField::XMLPort(Element& xmlelement, XMLPort::Mode mode){
+
+ SUPER(SpicedAsteroidField, XMLPort, xmlelement, mode);
+
XMLPortParam(SpicedAsteroidField, "count", setCount, getCount, xmlelement, mode);
XMLPortParam(SpicedAsteroidField, "mDensity", setMineralDensity, getMineralDensity, xmlelement, mode);
XMLPortParam(SpicedAsteroidField, "position", setPosition, getPosition, xmlelement, mode);
@@ -173,17 +151,11 @@
}
+ void SpicedAsteroidField::XMLEventPort(Element& xmlelement, XMLPort::Mode mode){
-
- void SpicedAsteroidField::XMLEventPort(Element& xmlelement, XMLPort::Mode mode)
- {
- // SUPER(SpicedAsteroidField, XMLEventPort, xmlelement, mode);
-
- XMLPortEventState(SpicedAsteroidField, BaseObject, "vulnerability", setVulnerable, xmlelement, mode);
}
- void SpicedAsteroidField::registerVariables()
- {
+ void SpicedAsteroidField::registerVariables(){
registerVariable(this->count, VariableDirection::ToClient);
registerVariable(this->mDensity, VariableDirection::ToClient);
@@ -194,122 +166,13 @@
registerVariable(this->foggy, VariableDirection::ToClient);
registerVariable(this->fogDensity, VariableDirection::ToClient);
-
}
void SpicedAsteroidField::tick(float dt){
this->create();
- // orxout() << "SpicedAsteroidField is done. " << endl;
-
this->bAlive_ = false;
this->destroyLater();
}
-
-
-
-
}
-
-// --[[ fog generator
-// generates fog
-// posX, posY, posZ - position in space
-// size - size of billboard
-// brightness - [0,1] fog brightness
-// --]]
-// function generateFog(posX, posY, posZ, size, brightness)
-// print("<Billboard ")
-// print("position = \"")
-// print(posX) print(",")
-// print(posY) print(",")
-// print(posZ) print("\" ")
-// print("colour=\"")
-// print(brightness) print(",")
-// print(brightness) print(",")
-// print(brightness) print("\" ")
-// print("material=\"Smoke/Smoke\" scale=")
-// print(size)
-// print(" />")
-// end
-
-// --[[ asteroid field generator
-// generates asteroid field
-// posX, posY, posZ - position in space
-// minSize, maxSize - size boundaries of each asteroid
-// radius - size of the cube around position in space
-// count - number of asteroids
-// fog - enable fog 0/1
-// --]]
-// function asteroidField(posX, posY, posZ, minSize, maxSize, radius, count, fog)
-// for i = 1, count, 1 do
-// size = (math.random() * (maxSize - minSize)) + minSize
-// pX = (2 * math.random() * radius) - radius + posX
-// pY = (2 * math.random() * radius) - radius + posY
-// pZ = (2 * math.random() * radius) - radius + posZ
-// print("<StaticEntity ")
-
-// print("position = \"")
-// print(pX) print(",")
-// print(pY) print(",")
-// print(pZ) print("\" ")
-
-// print("scale = \"") print(size) print("\" ")
-
-// print("collisionType = static linearDamping = 0.8 angularDamping = 1 ")
-// print("collisiondamage = 1000 enablecollisiondamage = true>")
-
-// print("<attached>")
-// print("<Model mass=\"") print(size * 10) print("\" ")
-// print("mesh=\"ast") print(math.mod(i,6) + 1) print(".mesh\" />")
-// print("</attached>")
-
-// print("<collisionShapes> ")
-// print("<SphereCollisionShape radius=\"")
-// print(size * 2.5) print("\" />")
-// print("</collisionShapes>")
-
-// print("</StaticEntity>")
-
-// if fog == 1 and i % 5 == 0 then
-// generateFog(pX, pY, pZ, radius*0.04, 0.2)
-// end
-// end
-// end
-
-
-// --[[ asteroid belt generator
-// generates asteroid belt
-// posX, posY, posZ - position in space
-// yaw, pitch - rotation
-// minSize, maxSize - size boundaries of each asteroid
-// radius0, radius1 - inner/outer radius
-// count - number of asteroids
-// fog - enable fog 0/1
-// --]]
-// function asteroidBelt(centerX, centerY, centerZ, yaw, pitch, segments, minSize, maxSize, radius0, radius1, count, fog)
-// dPhi = (2 * math.pi) / segments
-// width = math.abs(radius1 - radius0)
-// radius = (radius1 + radius0) / 2
-// segmentCount = count / segments
-
-// print("<StaticEntity collisionType=static yaw=") print(yaw)
-// print(" pitch=") print(pitch)
-
-// print(" position = \"")
-// print(centerX) print(",")
-// print(centerY) print(",")
-// print(centerZ) print("\"")
-// print(">")
-
-// print("<attached>")
-
-// for i = 0, segments - 1, 1 do
-// asteroidField((radius * math.cos(i * dPhi)),
-// (radius * math.sin(i * dPhi)),
-// 0, minSize, maxSize, width, segmentCount, fog)
-// end
-
-// print("</attached>")
-// print("</StaticEntity>")
-// end
Modified: code/branches/AsteroidMining_HS17/src/modules/asteroidmining/SpicedAsteroidField.h
===================================================================
--- code/branches/AsteroidMining_HS17/src/modules/asteroidmining/SpicedAsteroidField.h 2017-12-11 16:39:48 UTC (rev 11663)
+++ code/branches/AsteroidMining_HS17/src/modules/asteroidmining/SpicedAsteroidField.h 2017-12-11 17:05:17 UTC (rev 11664)
@@ -26,6 +26,14 @@
*
*/
+/**
+
+ @file SpicedAsteroidField.h
+ @brief Asteroid field with lots of parameters. Derived from asteroidField.lua
+
+
+*/
+
#ifndef _SpicedAsteroidField_H__
#define _SpicedAsteroidField_H__
@@ -33,17 +41,13 @@
#include <string>
#include <vector>
-#include "interfaces/PickupCarrier.h"
-#include "interfaces/RadarViewable.h"
+
#include "worldentities/ControllableEntity.h"
-#include "worldentities/ExplosionPart.h"
-
#include "../../orxonox/worldentities/pawns/Pawn.h"
namespace orxonox // tolua_export
{
-
// tolua_export
class _OrxonoxExport SpicedAsteroidField : public Pawn // need pawn to get tick for clean argument passing
{ // tolua_export
@@ -50,6 +54,7 @@
public:
SpicedAsteroidField(Context* context);// This constructor is for XML access only!
+ SpicedAsteroidField(Context* c, Vector3 p, int minS, int maxS, int w, int count, bool f, float mD, float fD);
virtual ~SpicedAsteroidField();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
@@ -82,14 +87,13 @@
inline float getFogDensity(){return this->fogDensity;}
protected:
- // Da neue Argumente reinstellen
- //float asteroidVersion; // Bodenstrich-Konvention?,
- // Wert zwischen 1 und 6 (Spezialdinger?), die Mesh-Form
+
+ Context* context;
+
float count;
float mDensity; // Mineral density, between 0 and 1;
Vector3 position;
- Context* context;
int maxSize;
int minSize;
More information about the Orxonox-commit
mailing list