//! Basic Mesh class for the "sju" physics engine /*! * The mesh base class implements a non-movable mesh intended mainly for * terrains and other scenery structures. Its functionality will probably be * extended in the near future. */ /* Copyright (C) 2008-2010 Alejandro Valenzuela Roca, * * This file is part of MotorJ, a free framework for videogame creation. * * * MotorJ is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * MotorJ is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with MotorJ. If not, see . */ #ifndef PMESH_CLASS_H #define PMESH_CLASS_H #include #include "support.h" #include "sjuengine-types.h" #include "physicalobject-class.h" #include "collisions.h" class pMesh: public IPhysicalObject { public: pMesh(); virtual ~pMesh(); //! Respond to effects applied virtual void ApplyEffect(vector3 effect, vector3& pointOfAction, sjuPETypes effectType, IPhysicalObject* interactionObject); //! Establish mesh virtual void SetMesh(triangle ** mesh); //! Update position and speed at the end of each simulation cycle virtual void Update(float t_elapsed); //! Recalculate the triangles' normals void RecalcNormals(); //! Create a plane made of triangles vector3** CreateTriangleArray(float widthX, int points); //! Update internal collision data when adding objects (NOTE: normally called automatically by mjPhysics) virtual void OnNewObjectAdded(std::list& objects); //! Update internal collision data when removing objects (NOTE: normally called automatically by mjPhysics) virtual void OnObjectDeleted(unsigned posInList, std::list& objects); virtual void * GetRelevantCollisionData(vector3 pos); char ** collStatuses; unsigned triangleCount; protected: }; #endif