- Main Page
- Classes
- Files

- Search for |

# CollisionGeometry.h

Go to the documentation of this file.

    00001 /*****************************
    00002 File:      CollisionGeometry.h
    00003 Language:   C++ (header)
    00004 Project:    H3DNetworkingUtils
    00005 The contents of this file are subject to the Mozilla Public License
    00006 Version 1.1 (the "License"); you may not use this file except in
    00007 compliance with the License. You may obtain a copy of the License at
    00008 http://www.mozilla.org/MPL/
    00009
    00010 Software distributed under the License is distributed on an "AS IS"
    00011 basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
    00012 License for the specific language governing rights and limitations
    00013 under the License.
    00014
    00015 The Original Code is H3DNetworkingUtils v1.0.
    00016
    00017 The Initial Developer of the Original Code is CSIRO.
    00018 Portions created by the Initial Developer are Copyright (C) 1009 CSIRO. All Rights Reserved.
    00019 Contributor(s):
    00020     Chris Gunn  <Chris.Gunn@csiro.au> <ChrisJGunn@gmail.com>
    00021 ***************************/
    00022
    00025
    00026 #ifndef CollisionGeometry_H
    00027 #define CollisionGeometry_H
    00028
    00029
    00030 #include "H3DNetworkingUtils/Config.h"
    00031 #include <H3D/Transform.h>
    00032 #include <H3D/TransformInfo.h>
    00033 #include <H3DUtil/AutoRef.h>
    00034
    00035 namespace H3DNetworkingUtils {
    00036
    00043
    00044 class CollidableDynamic;
    00045
    00046 class H3D_NETWORKING_UTILS_DLL_SPEC CollisionGeometry : public H3D::Transform {
    00047 public:
    00048
    00050    CollisionGeometry();
    00051
    00053    static H3D::H3DNodeDatabase database;
    00054
    00056    virtual void initialize();
    00057
    00059    virtual void setDyn( CollidableDynamic *ptr );
    00060
    00062    CollidableDynamic * getDyn() {return collidable_dynamicP;}
    00063
    00065    H3D::Matrix4f getLocalToGlobal() {
    00066       return child_local_info->accForwardMatrix->getValue();
    00067    }
    00068
    00070    H3D::Matrix4f getGlobalToLocal() {
    00071       return child_local_info->accInverseMatrix->getValue();
    00072    }
    00073
    00075    H3D::Vec3f getLocalPosition() {
    00076       return translation->getValue();
    00077    }
    00078
    00080    H3D::Vec3f getGlobalPosition() {
    00081       return getLocalToGlobal() * H3D::Vec3f(0,0,0);
    00082    }
    00083
    00085    virtual CollisionGeometry * clone() {return new CollisionGeometry;}
    00086
    00088    virtual void copy(CollisionGeometry * newP);
    00089
    00091    void setLayer(u_int l) {layer = l;}
    00092
    00095    void setLocalOffset(H3D::Vec3f offs) {local_offset->translation->setValue(offs);}
    00096
    00097
    00098 protected:
    00099    H3D::AutoRef<H3D::Transform> local_offset;
    00100    H3D::AutoRef<H3D::TransformInfo> child_local_info;
    00101    CollidableDynamic * collidable_dynamicP;  // Can't use a AutoRef here as it causews an unwanted ref()
    00102
    00103    u_int layer;
    00104    H3D::Vec3f trans;
    00105    bool initialized;
    00106 };
    00107
    00108
    00109
    00110 }
    00111
    00112 #endif