osg.Vec4us是OpenSceneGraph库中的四维无符号短整型向量类。
typedef Vec<4, unsigned short> Vec4us;
Vec4us()
Vec4us(unsigned short x, unsigned short y, unsigned short z, unsigned short w)
Vec4us(const Vec4ub& vec)
Vec4us(const Vec4s& vec)
Vec4us(const Vec4i& vec)
Vec4us(const Vec4f& vec)
Vec4us(const Vec4d& vec)
void set(unsigned short x, unsigned short y, unsigned short z, unsigned short w)
unsigned short* ptr()
const unsigned short* ptr() const
void zero()
template<typename> T length(const Vec<4,T>& v)
template<typename> T length2(const Vec<4,T>& v)
template<typename> Vec<4,T> normalize(const Vec<4,T>& v)
template<typename> Vec<4,T> operator + (const Vec<4,T>& v1, const Vec<4,T>& v2)
template<typename> Vec<4,T> operator - (const Vec<4,T>& v1, const Vec<4,T>& v2)
template<typename> Vec<4,T> operator - (const Vec<4,T>& v)
template<typename> T operator * (const Vec<4,T>& v1, const Vec<4,T>& v2)
template<typename> Vec<4,T> operator * (const Vec<4,T>& v, T value)
template<typename> Vec<4,T> operator * (T value, const Vec<4,T>& v)
template<typename> Vec<4,T> operator / (const Vec<4,T>& v, T value)
template<typename> bool operator == (const Vec<4,T>& v1, const Vec<4,T>& v2)
template<typename> bool operator != (const Vec<4,T>& v1, const Vec<4,T>& v2)
std::ostream& operator << (std::ostream& os, const Vec4us& v)
std::istream& operator >> (std::istream& is, Vec4us& v)
#include <osg/Vec4us>
#include <iostream>
int main()
{
// 创建一个Vec4us对象
osg::Vec4us vec(65535, 32767, 16383, 8191);
// 获取Vec4us对象的元素
std::cout << "x = " << vec.x() << ", "
<< "y = " << vec.y() << ", "
<< "z = " << vec.z() << ", "
<< "w = " << vec.w() << std::endl;
// 修改Vec4us对象的元素
vec.set(4095, 2047, 1023, 511);
// 获取Vec4us对象的指针
const unsigned short* ptr = vec.ptr();
std::cout << "ptr[0] = " << ptr[0] << ", "
<< "ptr[1] = " << ptr[1] << ", "
<< "ptr[2] = " << ptr[2] << ", "
<< "ptr[3] = " << ptr[3] << std::endl;
return 0;
}