vector4.h

来自「java实现的简单的分形树。简单易学!是学习分形知识的很好的例子。其java语法」· C头文件 代码 · 共 50 行

H
50
字号
// --------------------------------------------------------------------------
// Dingus project - a collection of subsystems for game/graphics applications
// --------------------------------------------------------------------------

#ifndef __VECTOR_4_H
#define __VECTOR_4_H

#include "Vector3.h"

namespace dingus {


// --------------------------------------------------------------------------

/**
 *  4D vector.
 */
struct SVector4 : public D3DXVECTOR4 {
public:
	SVector4();
	SVector4( const float* f );
	SVector4( const D3DXFLOAT16* f );
	SVector4( float x, float y, float z, float w );
	SVector4( const D3DXVECTOR4& v );
	SVector4( const SVector3& v ); // w=1

    operator D3DXVECTOR4&();
    operator const D3DXVECTOR4&() const;

	void		set( float vx, float vy, float vz, float vw );
};


inline SVector4::SVector4() : D3DXVECTOR4() { };
inline SVector4::SVector4( const float *f ) : D3DXVECTOR4(f) { };
inline SVector4::SVector4( const D3DXFLOAT16 *f ) : D3DXVECTOR4(f) { };
inline SVector4::SVector4( float vx, float vy, float vz, float vw ) : D3DXVECTOR4(vx,vy,vz,vw) { };
inline SVector4::SVector4( const D3DXVECTOR4& v ) : D3DXVECTOR4(v) { };
inline SVector4::SVector4( const SVector3& v ) : D3DXVECTOR4(v.x,v.y,v.z,1) { };

inline void SVector4::set( float vx, float vy, float vz, float vw ) { x=vx; y=vy; z=vz; w=vw; };

inline SVector4::operator D3DXVECTOR4&() { return *this; }
inline SVector4::operator const D3DXVECTOR4&() const { return *this; }


}; // namespace

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?