Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/physics/fields/field.cc @ 10616

Last change on this file since 10616 was 9869, checked in by bensch, 18 years ago

orxonox/trunk: merged the new_class_id branche back to the trunk.
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/new_class_id trunk -r9683:HEAD
no conflicts… puh..

File size: 1.7 KB
RevLine 
[4728]1/*
[1853]2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2004 orx
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
[1855]10
11   ### File Specific:
[4179]12   main-programmer: Benjamin Grauer
[1855]13   co-programmer: ...
[1853]14*/
15
[5357]16#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_PHYSICS
[1853]17
[4179]18#include "field.h"
[1853]19
[4394]20#include "physics_engine.h"
21
[7193]22#include "util/loading/factory.h"
23#include "util/loading/load_param.h"
[1853]24
[9869]25ObjectListDefinition(Field);
[9406]26
[3245]27/**
[9869]28 * @brief standard constructor
[3245]29*/
[4728]30Field::Field ()
[3365]31{
[4728]32  this->init();
[3365]33}
[1853]34
[4728]35/**
[9869]36 * @brief standard deconstructor
37 */
[4728]38Field::~Field ()
[3543]39{
[4394]40   PhysicsEngine::getInstance()->removeField(this);
[3543]41}
[4179]42
[4728]43/**
[9869]44  * @brief initializes a Field
45 */
[4746]46void Field::init()
[4728]47{
[9869]48  this->registerObject(this, Field::_objectList);
[4728]49  this->setMagnitude(1);
50  this->setAttenuation(0);
[4179]51
[4728]52  PhysicsEngine::getInstance()->addField(this);
53}
54
[4179]55/**
[9869]56 * @param root The XML-element to load settings from
[4728]57 */
58void Field::loadParams(const TiXmlElement* root)
59{
[6512]60  PNode::loadParams(root);
[4728]61
[5671]62  LoadParam(root, "magnitude", this, Field, setMagnitude)
[5652]63      .describe("sets the magnitude of this Field")
[7199]64      .defaultValues(1.0f);
[4728]65
[5671]66  LoadParam(root, "attenuation", this, Field, setAttenuation)
[4728]67      .describe("sets the attenuation of this Field.");
68
69}
70
71/**
[4836]72 * @param magnitude the magnitude of the Field.
[4179]73*/
[4728]74void Field::setMagnitude(float magnitude)
[4179]75{
76  this->magnitude = magnitude;
77}
78
79/**
[4836]80 * @param attenuation The attenuation of the Field (the bigger the smaller the region of influence)
[4179]81*/
[4728]82void Field::setAttenuation(float attenuation)
[4179]83{
84  this->attenuation = attenuation;
85}
Note: See TracBrowser for help on using the repository browser.