Files
donnyandClaude Fable 5.1 da27435cdb server: import the duel server (nanahira/ygopro server at 52c868ce)
The server tree of https://code.moenext.com/nanahira/ygopro.git, branch
server, commit 52c868ce071ea0f2fcb0cf39bf2fb4151d12b90c, stock: gframe/,
premake5.lua, .ci/, LICENSE, and gframe/ygopro.rc + .ico (upstream keeps
them in resource/ and copies them in before building). No game assets, no
scripts, no ocgcore submodule: the core is ../core.

The third-party sources upstream's Windows CI downloads are vendored here
at the positions its premake expects, each with its premake fragment from
upstream's premake/ folder inside it: lua 5.4.8, sqlite 3.53.3, libevent
2.1.13-stable (tests, samples and autotools helpers left out; the files
its Windows prebuild copies into include/ left out), zlib 1.3.2 (contrib
and examples left out), xz 5.8.3 (src/liblzma + src/common only), and
irrlicht 1.9 from mycard at 20f86d25: include/ plus the source/Irrlicht
headers and the 11 .cpp files the server's zip reader project compiles.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-14 20:58:21 -07:00

153 lines
5.3 KiB
C++

// Copyright (C) 2002-2012 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef IRR_C_SCENE_COLLISION_MANAGER_H_INCLUDED
#define IRR_C_SCENE_COLLISION_MANAGER_H_INCLUDED
#include "ISceneCollisionManager.h"
#include "ISceneManager.h"
#include "IVideoDriver.h"
namespace irr
{
namespace scene
{
//! The Scene Collision Manager provides methods for performing collision tests and picking on scene nodes.
class CSceneCollisionManager : public ISceneCollisionManager
{
public:
//! constructor
CSceneCollisionManager(ISceneManager* smanager, video::IVideoDriver* driver);
//! destructor
virtual ~CSceneCollisionManager();
//! Returns the scene node, which is currently visible at the given
//! screen coordinates, viewed from the currently active camera.
virtual ISceneNode* getSceneNodeFromScreenCoordinatesBB(const core::position2d<s32>& pos,
s32 idBitMask=0, bool bNoDebugObjects=false, ISceneNode* root=0) IRR_OVERRIDE;
//! Returns the nearest scene node which collides with a 3d ray and
//! whose id matches a bitmask.
virtual ISceneNode* getSceneNodeFromRayBB(const core::line3d<f32>& ray,
s32 idBitMask=0, bool bNoDebugObjects=false,
ISceneNode* root=0) IRR_OVERRIDE;
//! Returns the scene node, at which the given camera is looking at and
//! which id matches the bitmask.
virtual ISceneNode* getSceneNodeFromCameraBB(const ICameraSceneNode* camera,
s32 idBitMask=0, bool bNoDebugObjects = false) IRR_OVERRIDE;
//! Finds the nearest collision point of a line and lots of triangles, if there is one.
virtual bool getCollisionPoint(SCollisionHit& hitResult, const core::line3d<f32>& ray,
ITriangleSelector* selector) IRR_OVERRIDE;
//! Collides a moving ellipsoid with a 3d world with gravity and returns
//! the resulting new position of the ellipsoid.
virtual core::vector3df getCollisionResultPosition(
ITriangleSelector* selector,
const core::vector3df &ellipsoidPosition,
const core::vector3df& ellipsoidRadius,
const core::vector3df& ellipsoidDirectionAndSpeed,
core::triangle3df& triout,
core::vector3df& hitPosition,
bool& outFalling,
ISceneNode*& outNode,
f32 slidingSpeed,
const core::vector3df& gravityDirectionAndSpeed) IRR_OVERRIDE;
//! Returns a 3d ray which would go through the 2d screen coordinates.
virtual core::line3d<f32> getRayFromScreenCoordinates(
const core::position2d<s32> & pos, const ICameraSceneNode* camera = 0) IRR_OVERRIDE;
//! Calculates 2d screen position from a 3d position.
virtual core::position2d<s32> getScreenCoordinatesFrom3DPosition(
const core::vector3df & pos, const ICameraSceneNode* camera=0, bool useViewPort=false) IRR_OVERRIDE;
//! Gets the scene node and nearest collision point for a ray based on
//! the nodes' id bitmasks, bounding boxes and triangle selectors.
virtual ISceneNode* getSceneNodeAndCollisionPointFromRay(
SCollisionHit& hitResult,
const core::line3df& ray,
s32 idBitMask = 0,
ISceneNode * collisionRootNode = 0,
bool noDebugObjects = false) IRR_OVERRIDE;
private:
//! recursive method for going through all scene nodes
void getPickedNodeBB(ISceneNode* root, core::line3df& ray, s32 bits,
bool bNoDebugObjects,
f32& outbestdistance, ISceneNode*& outbestnode);
//! recursive method for going through all scene nodes
void getPickedNodeFromBBAndSelector(
SCollisionHit& hitResult,
ISceneNode * root,
core::line3df & ray,
s32 bits,
bool noDebugObjects,
f32 & outBestDistanceSquared);
struct SCollisionData
{
core::vector3df eRadius;
core::vector3df R3Velocity;
core::vector3df R3Position;
core::vector3df velocity;
core::vector3df normalizedVelocity;
core::vector3df basePoint;
bool foundCollision;
f32 nearestDistance;
core::vector3df intersectionPoint;
core::triangle3df intersectionTriangle;
irr::scene::ISceneNode* node;
s32 triangleHits;
f32 slidingSpeed;
ITriangleSelector* selector;
};
//! Tests the current collision data against an individual triangle.
/**
\param colData: the collision data.
\param triangle: the triangle to test against.
\return true if the triangle is hit (and is the closest hit), false otherwise */
bool testTriangleIntersection(SCollisionData* colData,
const core::triangle3df& triangle);
//! recursive method for doing collision response
core::vector3df collideEllipsoidWithWorld(ITriangleSelector* selector,
const core::vector3df &position,
const core::vector3df& radius, const core::vector3df& velocity,
f32 slidingSpeed,
const core::vector3df& gravity, core::triangle3df& triout,
core::vector3df& hitPosition,
bool& outFalling,
ISceneNode*& outNode);
core::vector3df collideWithWorld(s32 recursionDepth, SCollisionData &colData,
const core::vector3df& pos, const core::vector3df& vel);
inline bool getLowestRoot(f32 a, f32 b, f32 c, f32 maxR, f32* root) const;
ISceneManager* SceneManager;
video::IVideoDriver* Driver;
core::array<core::triangle3df> Triangles; // triangle buffer
};
} // end namespace scene
} // end namespace irr
#endif