#ifndef object_h #define object_h #include <jgl/boundingbox.h> #include "sobject.h" class rtl_object : public rtl_subobject { public: ~rtl_object(); inline jFlt intersect( const rtl_ray&, bool = false ); inline jNorm3 normal(); virtual rtl_material* material() { return mat ? mat : rtl_subobject::material(); } virtual void setMaterial( rtl_material* ); const jMat4& T() const { return mT; } const jMat4& iT() const { return miT; } virtual const jVec3& rootobjectspace() const { return osi; } void setBounds( const jBBox& ); jUInt index() const { return objidx; } void scale( const jVec3& ); void translate( const jVec3& ); void rotate( jUInt, jFlt ); virtual jVec2 uv( const jVec3& ) { return jVec2(0,0); } bool volintersect( const jBBox& B ) const { return flags().on(Bounded) ? bnd.intersect(B) : rtl_subobject::volintersect(B); } virtual const jVec3& objectspace() const { return osi; } virtual void transformation( const jMat4& ); static const jULng Entrance; static const jULng Rehittable; static const jULng ShadowCaster; enum Type { objAbstract, objBox, objCSG, objPolyhedron, objSphere, objJBT, objCSOFT, objSuperEllipsoid, objTorus, objFloor, objCylinder, objCone }; virtual Type type() const { return objAbstract; } protected: rtl_object(); friend class rtl_world; friend class rtl_illumination; friend class rtl_csg; virtual rtl_object* laststruck() { return this; } virtual jFlt lclintersect( const rtl_ray& )=0; virtual jNorm3 lclnormal( const jVec3& )=0; virtual void objectspace( const jVec3& _osi ) { osi = _osi; } virtual jFlt rehit() { return -1; } jVec3 osi; jMat4 mT, miT; rtl_material* mat; rtl_ray tray; jFlt t; jUInt objidx; friend void rtl_initialize(); friend void rtl_terminate(); }; #include "object.inl" #endif