⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mlrvertex.cpp

📁 机甲指挥官2源代码
💻 CPP
字号:
//===========================================================================//
// Copyright (C) Microsoft Corporation. All rights reserved.                 //
//===========================================================================//

#include "MLRStuff.hpp"

#if !defined(MLRVERTEX_HPP)
	#include "MLRVertex.hpp"
#endif

//#############################################################################
//############################    MLRVertex    ################################
//#############################################################################

MLRVertex::ClassData*
	MLRVertex::DefaultData = NULL;

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
void
	MLRVertex::InitializeClass()
{
	Verify(!DefaultData);
	DefaultData =
		new ClassData(
			MLRVertexClassID,
			"MLRVertex",
			RegisteredClass::DefaultData
		);
	Register_Object(DefaultData);
}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
void
	MLRVertex::TerminateClass()
{
	Unregister_Object(DefaultData);
	delete DefaultData;
	DefaultData = NULL;
}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
MLRVertex::MLRVertex(MemoryStream *stream):
	RegisteredClass(DefaultData)
{ 
	Check_Pointer(this);
	Check_Object(stream);

	*stream >> used;

	*stream >> coord;
	*stream >> color;
	*stream >> normal;
	*stream >> texCoord[0];
	*stream >> texCoord[1];
}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
MLRVertex::MLRVertex():
	RegisteredClass(DefaultData)
{ 
}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
MLRVertex::MLRVertex
	(const Point3D *v, const RGBAColor *c,
	 const Vector3D *n, const Vector2DOf<Scalar> *tc
	) : RegisteredClass(DefaultData)
{
	Verify(v);

	*this = *v;
	used = 1;

	if(c)
	{
		*this = *c;
		used |= 2;
	}

	if(n)
	{
		*this = *n;
		used |= 4;
	}

	if(tc)
	{
		*this = *tc;
		used |= 8;
	}
}


//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
MLRVertex::MLRVertex
	(const Point3D& v, const RGBAColor& c,
	 const Vector3D& n, const Vector2DOf<Scalar>& tc
	) : RegisteredClass(DefaultData)
{
	Verify(v);

	*this = v;
	*this = c;
	*this = n;
	*this = tc;
	used = 0xf;
}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
MLRVertex::~MLRVertex()
{
}


//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
MLRVertex*
	MLRVertex::Make(MemoryStream *stream)
{
	return new MLRVertex(stream);
}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
void
	MLRVertex::Save(MemoryStream *stream)
{
	Check_Object(this);
	Check_Object(stream);

	*stream << used;

	*stream << coord;
	*stream << color;
	*stream << normal;
	*stream << texCoord[0];
	*stream << texCoord[1];
}



⌨️ 快捷键说明

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