# Copyright (c) 2007 SIEGE Development Team
# All rights reserved.
#
# This file is part of libSIEGE.
#
# This software is copyrighted work licensed under the terms of the
# 2-clause BSD license. Please consult the file "license.txt" for
# details.
#
# If you did not recieve the file with this program, please email
# Tim Chas <darkuranium@gmail.com>.

from siege.common cimport *
from body cimport *

cdef extern from "siege/physics/shape.h":
    struct SGPhysicsShape:
        void* handle
        SGPhysicsBody* body
        
        float x
        float y
        size_t numverts
        float* verts
    
    SGPhysicsShape* sgPhysicsShapeCreate(SGPhysicsBody* body, SGenum type)
    SGPhysicsShape* sgPhysicsShapeCreateSegment(SGPhysicsBody* body, float x1, float y1, float x2, float y2, float width)
    SGPhysicsShape* sgPhysicsShapeCreatePoly(SGPhysicsBody* body, float x, float y, float* verts, size_t numverts)
    SGPhysicsShape* sgPhysicsShapeCreateCircle(SGPhysicsBody* body, float x, float y, float r1, float r2)
    void sgPhysicsShapeDestroy(SGPhysicsShape* shape)

    void sgPhysicsShapeSetGroup(SGPhysicsShape* shape, SGuint group)
    SGuint sgPhysicsShapeGetGroup(SGPhysicsShape* shape)
    void sgPhysicsShapeSetFriction(SGPhysicsShape* shape, float friction)
    float sgPhysicsShapeGetFriction(SGPhysicsShape* shape)
    void sgPhysicsShapeSetRestitution(SGPhysicsShape* shape, float restitution)
    float sgPhysicsShapeGetRestitution(SGPhysicsShape* shape)
    void sgPhysicsShapeSetData(SGPhysicsShape* shape, void* data)
    void* sgPhysicsShapeGetData(SGPhysicsShape* shape)

    float sgPhysicsShapeGetAreaS(SGPhysicsShape* shape)
    float sgPhysicsShapeGetAreaU(SGPhysicsShape* shape)
    float sgPhysicsShapeGetMass(SGPhysicsShape* shape, float density)
    float sgPhysicsShapeGetMomentMass(SGPhysicsShape* shape, float mass)
    float sgPhysicsShapeGetMomentDensity(SGPhysicsShape* shape, float density)

    void sgPhysicsShapeGetBBox(SGPhysicsShape* shape, float* t, float* l, float* b, float* r)
    void sgPhysicsShapeDrawDBG(SGPhysicsShape* shape)

cdef class Shape:
    cdef SGPhysicsShape* handle
    cdef object pydata
    
    cpdef destroy(self)
cdef class SegmentShape(Shape):
    pass
cdef class PolyShape(Shape):
    pass
cdef class CircleShape(Shape):
    pass

