Skip to content

Commit

Permalink
Add X-Ray 2.0 (18 December 2010)
Browse files Browse the repository at this point in the history
  • Loading branch information
acidicMercury8 committed Nov 17, 2019
1 parent 13d9143 commit 3efad90
Show file tree
Hide file tree
Showing 2,979 changed files with 446,380 additions and 0 deletions.
98 changes: 98 additions & 0 deletions src/xray/animation/anim_track_common.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
////////////////////////////////////////////////////////////////////////////
// Created : 24.12.2009
// Author : Konstantin Slipchenko
// Copyright (C) GSC Game World - 2009
////////////////////////////////////////////////////////////////////////////

#ifndef ANIM_TRACK_COMMON_H_INCLUDED
#define ANIM_TRACK_COMMON_H_INCLUDED

namespace xray {
namespace animation {

enum enum_channel_id
{
channel_translation_x = 0,
channel_translation_y,
channel_translation_z,
channel_rotation_x,
channel_rotation_y,
channel_rotation_z,
channel_scale_x,
channel_scale_y,
channel_scale_z,
channel_max,
channel_unknown
};

struct frame
{
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable:4201)
#endif // #ifdef _MSC_VER
union{
struct{
xray::math::float3_pod translation;
xray::math::float3_pod rotation;
xray::math::float3_pod scale;
};
float channels[channel_max];
};
#ifdef _MSC_VER
# pragma warning(pop)
#endif // #ifdef _MSC_VER
}; // struct frame

//\li matrix = [S] * [RO] * [R] * [JO] * [IS] * [T]



inline void frame_matrix( const frame &f, float4x4 &matrix_, const float3 &parent_scale_, float3 &scale_ )
{

XRAY_UNREFERENCED_PARAMETER( parent_scale_);

scale_ = f.scale;

float4x4 rotation_ = create_rotation ( f.rotation );


//matrix = scale*rotation*translation*parent_scale*translation ;
matrix_ = rotation_;
matrix_.c.xyz() = f.translation;
}

inline void frame_matrix( const frame &f, float4x4 &matrix )
{
float3 scale;
float3 parent_scale( 1, 1, 1 );
animation::frame_matrix( f, matrix, parent_scale, scale );
}

inline float4x4 frame_matrix( const frame &f )
{
float4x4 ret;
frame_matrix( f, ret );
return ret;
}

inline frame matrix_to_frame( const float4x4 &m )
{
frame f;
f.rotation = m.get_angles_xyz( );
f.translation = m.c.xyz();
f.scale = float3(1,1,1);
return f;
}

static const frame zero = { float3().set(0,0,0),float3().set(0,0,0),float3().set(0,0,0) };
static const float default_fps = 30.f;




} // namespace animation
} // namespace xray

#endif // #ifndef ANIM_TRACK_COMMON_H_INCLUDED
41 changes: 41 additions & 0 deletions src/xray/animation/api.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
////////////////////////////////////////////////////////////////////////////
// Created : 17.12.2008
// Author : Dmitriy Iassenev
// Copyright (C) GSC Game World - 2009
////////////////////////////////////////////////////////////////////////////

#ifndef XRAY_ANIMATION_API_H_INCLUDED
#define XRAY_ANIMATION_API_H_INCLUDED

#ifndef XRAY_ANIMATION_API
# ifdef XRAY_STATIC_LIBRARIES
# define XRAY_ANIMATION_API
# else // #ifdef XRAY_STATIC_LIBRARIES
# ifdef XRAY_ANIMATION_BUILDING
# define XRAY_ANIMATION_API XRAY_DLL_EXPORT
# else // #ifdef XRAY_ANIMATION_BUILDING
# ifndef XRAY_ENGINE_BUILDING
# define XRAY_ANIMATION_API XRAY_DLL_IMPORT
# else // #ifndef XRAY_ENGINE_BUILDING
# define XRAY_ANIMATION_API XRAY_DLL_EXPORT
# endif // #ifndef XRAY_ENGINE_BUILDING
# endif // #ifdef XRAY_ANIMATION_BUILDING
# endif // #ifdef XRAY_STATIC_LIBRARIES
#endif // #ifndef XRAY_ANIMATION_API

namespace xray {
namespace animation {

struct engine;
struct world;

typedef memory::doug_lea_allocator_type allocator_type;

XRAY_ANIMATION_API world* create_world ( engine& engine );
XRAY_ANIMATION_API void destroy_world ( world*& world );
XRAY_ANIMATION_API void memory_allocator( allocator_type& allocator );

} // namespace animation
} // namespace xray

#endif // #ifndef XRAY_ANIMATION_API_H_INCLUDED
29 changes: 29 additions & 0 deletions src/xray/animation/engine.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
////////////////////////////////////////////////////////////////////////////
// Created : 17.12.2008
// Author : Dmitriy Iassenev
// Copyright (C) GSC Game World - 2009
////////////////////////////////////////////////////////////////////////////

#ifndef XRAY_ANIMATION_ENGINE_H_INCLUDED
#define XRAY_ANIMATION_ENGINE_H_INCLUDED

namespace xray {

namespace render {
struct world;
} // namespace render

namespace animation {

struct XRAY_NOVTABLE engine {
virtual render::world& get_renderer_world ( ) = 0;


protected:
XRAY_DECLARE_PURE_VIRTUAL_DESTRUCTOR( engine )
}; // class engine

} // namespace animation
} // namespace xray

#endif // #ifndef XRAY_ANIMATION_ENGINE_H_INCLUDED
43 changes: 43 additions & 0 deletions src/xray/animation/i_animation_action.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
////////////////////////////////////////////////////////////////////////////
// Created : 22.04.2010
// Author : Konstantin Slipchenko
// Copyright (C) GSC Game World - 2010
////////////////////////////////////////////////////////////////////////////

#ifndef I_ANIMATION_ACTION_H_INCLUDED
#define I_ANIMATION_ACTION_H_INCLUDED

namespace xray {

namespace render {
namespace debug {
struct renderer;
} // namespace debug
} // namespace render

namespace animation {

class i_animation_controller_set;

class i_animation_action {

public:
virtual void get_displacement_transform ( float4x4 &m, const buffer_vector< float > &weights )const = 0;
virtual u32 animations_number ( )const = 0;
virtual float duration ( )const = 0;
virtual float run ( i_animation_controller_set *set, const buffer_vector< float > &from_weights, const buffer_vector< float > &weights, u32 step, float time )const =0;
virtual u32 get_id ( )const = 0;
virtual u32 gait ( )const = 0;
virtual u32 bone_index ( pcstr bone_name )const =0;
virtual void local_bone_matrix ( float4x4 &m, u32 bone_idx, const buffer_vector< float > &weights )const =0;
virtual pcstr name ( )const = 0;

protected:
XRAY_DECLARE_PURE_VIRTUAL_DESTRUCTOR( i_animation_action )

}; // class i_animation_action

} // namespace animation
} // namespace xray

#endif // #ifndef I_ANIMATION_ACTION_H_INCLUDED
35 changes: 35 additions & 0 deletions src/xray/animation/i_animation_channel_data.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
////////////////////////////////////////////////////////////////////////////
// Created : 19.01.2010
// Author : Konstantin Slipchenko
// Copyright (C) GSC Game World - 2010
////////////////////////////////////////////////////////////////////////////

#ifndef I_ANIMATION_CHANNEL_DATA_H_INCLUDED
#define I_ANIMATION_CHANNEL_DATA_H_INCLUDED

#include <xray/animation/i_bi_spline_data.h>

namespace xray {
namespace animation {

class i_animation_channel_data {

public:
typedef i_bi_spline_data<float> i_data_channel_type;

public:
virtual void save ( xray::configs::lua_config_value config )const =0;
virtual void load ( xray::configs::lua_config_value const& config ) =0;

public:
virtual const i_data_channel_type& bi_spline ()const =0;
virtual i_data_channel_type& bi_spline () =0;

protected:
XRAY_DECLARE_PURE_VIRTUAL_DESTRUCTOR( i_animation_channel_data )
}; // class i_animation_channel_data

} // namespace animation
} // namespace xray

#endif // #ifndef I_ANIMATION_CHANNEL_DATA_H_INCLUDED
40 changes: 40 additions & 0 deletions src/xray/animation/i_animation_controller_set.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
////////////////////////////////////////////////////////////////////////////
// Created : 22.04.2010
// Author : Konstantin Slipchenko
// Copyright (C) GSC Game World - 2010
////////////////////////////////////////////////////////////////////////////

#ifndef I_ANIMATION_CONTROLLER_SET_H_INCLUDED
#define I_ANIMATION_CONTROLLER_SET_H_INCLUDED

namespace xray {
namespace animation {

class i_animation_action;

class i_animation_controller_set {

public:
virtual i_animation_action const *taget_action ()const = 0;
virtual void get_taget_transform ( float4x4 &m )const = 0;
virtual i_animation_action const *action ( u32 id )const = 0;
virtual u32 num_actions ( )const = 0;
virtual void set_callback_on_loaded ( const boost::function< void ( ) > &cb ) = 0;
virtual void render ( render::debug::renderer& renderer, float time_global ) const = 0;
virtual float4x4 const &position ()const = 0;
virtual float crrent_action_start_time()const = 0;
virtual bool loaded ()const = 0;
virtual void reset ( )= 0;
virtual void init ( u32 id, const buffer_vector< float > &weights, float time_global ) = 0;
virtual void get_bone_world_matrix ( float4x4 &m, u32 bone_id ) const = 0;

//virtual void start_transition ( const animation_group_action& next_action, float4x4 &root_displacement, const buffer_vector< float > &weights, float time_global ) = 0;
//virtual void update ( float4x4 &root_displacement, float time_global ) = 0;

XRAY_DECLARE_PURE_VIRTUAL_DESTRUCTOR( i_animation_controller_set )
}; // class i_animation_controller_set

} // namespace animation
} // namespace xray

#endif // #ifndef I_ANIMATION_CONTROLLER_SET_H_INCLUDED
26 changes: 26 additions & 0 deletions src/xray/animation/i_bi_spline_data.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
////////////////////////////////////////////////////////////////////////////
// Created : 16.01.2010
// Author : Konstantin Slipchenko
// Copyright (C) GSC Game World - 2010
////////////////////////////////////////////////////////////////////////////

#ifndef I_BI_SPLINE_DATA_H_INCLUDED
#define I_BI_SPLINE_DATA_H_INCLUDED

namespace xray {
namespace animation {

template<typename Point_type>
struct i_bi_spline_data
{
virtual void add_point ( const std::pair<float, Point_type> &p ) = 0;

protected:
XRAY_DECLARE_PURE_VIRTUAL_DESTRUCTOR( i_bi_spline_data )
};

} // namespace animation
} // namespace xray


#endif // #ifndef BI_SPLINE_DATA_H_INCLUDED
35 changes: 35 additions & 0 deletions src/xray/animation/i_bone_animation_data.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
////////////////////////////////////////////////////////////////////////////
// Created : 19.01.2010
// Author : Konstantin Slipchenko
// Copyright (C) GSC Game World - 2010
////////////////////////////////////////////////////////////////////////////

#ifndef I_BONE_ANIMATION_DATA_H_INCLUDED
#define I_BONE_ANIMATION_DATA_H_INCLUDED

#include <xray/animation/i_animation_channel_data.h>
#include <xray/animation/anim_track_common.h>

namespace xray {
namespace animation {

class i_animation_channel_data;

struct i_bone_animation_data {
public:
virtual void save ( xray::configs::lua_config_value config )const = 0;
virtual void load ( xray::configs::lua_config_value const& config ) = 0;

public:
virtual i_animation_channel_data &channel ( xray::animation::enum_channel_id ch ) = 0;
virtual const i_animation_channel_data &channel ( xray::animation::enum_channel_id ch )const = 0;
virtual bool compare ( i_bone_animation_data const &d )const = 0;

protected:
XRAY_DECLARE_PURE_VIRTUAL_DESTRUCTOR( i_bone_animation_data )
}; // class i_bone_animation_data

} // namespace animation
} // namespace xray

#endif // #ifndef I_BONE_ANIMATION_DATA_H_INCLUDED
Loading

0 comments on commit 3efad90

Please sign in to comment.