//------------------------------------------------------------
// $Id: VertexIntensity.h,v 1.2 2000/06/14 13:29:37 yamauchi Exp $
//------------------------------------------------------------
//	VertexIntensity.h
//	1996/3/18 
//	last change 1999/6/15
//	(C) Copyright 1996-1999 YAMAUCHI Hitoshi 山内 斉
//	object から VertexIntensity を分離
//------------------------------------------------------------
#ifndef _VertexIntensity_h
#define _VertexIntensity_h

// #include <stdlib.h>
// #include "constants.h"
// #include "IntVec3.h"
// #include "material.h"
// #include "ray.h"
// #include "mpi2exit.h"

//------------------------------------------------------------
// 頂点とポリゴン番号と輝度の情報
//------------------------------------------------------------
class VertexIntensity {
protected:
    int	    mPolygonID;		// 頂点の属していたポリゴン番号 
    IntVec3 mDestSpcPos;	// 到着次空間指標
    Vector3 mIntensity;		// 頂点の輝度
    Vector3 mVertex;		// 頂点の座標

    // 未送信方向(斜めに移動する場合には2回送信が必要であり、この値が 
    // DIR_HERE でないということは未送信の方向があるということ  
    // と考えたが効率の良い実装が手間なためにまずは rank で送信する。
    // IMPROVE HERE
    //     IntVec3 mNextSpcPos;	// 次に着く空間指標
    //     DIR_3D  mRestDir;

public:
    // 送信・受信時のタグ
    static communication_tags_e getTAG(void)	
    {
	return(TAG_INT_VER_e); 
    }

public:
    VertexIntensity(void) : mPolygonID(-1){} //, mRestDir(DIR_HERE){};
    VertexIntensity(const VertexIntensity& rhs)
    {
	this->mPolygonID	= rhs.mPolygonID;
	this->mDestSpcPos	= rhs.mDestSpcPos;
	this->mIntensity	= rhs.mIntensity;
	this->mVertex		= rhs.mVertex;
	// this->mRestDir		= rhs.mRestDir;
    }
    const VertexIntensity& operator=(const VertexIntensity& rhs)
    {
	if(this != &rhs)
	{
	    this->mPolygonID	= rhs.mPolygonID;
	    this->mDestSpcPos	= rhs.mDestSpcPos;
	    this->mIntensity	= rhs.mIntensity;
	    this->mVertex	= rhs.mVertex;
	    // this->mRestDir	= rhs.mRestDir;
	}
	return(*this);
    }
    void set(int aPolygonID, 	         const IntVec3& aDestSpcPos,
	     const Vector3& anIntensity, const Vector3& aVertex)
    {
	static const char *cs = "Error! : at VertexIntensity::set ";
	if(aPolygonID < 0)
	{	
	    cout << cs << "illegal polygon id " << aPolygonID << endl;
	    commMpi2_exit(1);
	}
	this->mPolygonID  = aPolygonID;
	this->mDestSpcPos = aDestSpcPos;
	this->mIntensity  = anIntensity;
	this->mVertex	  = aVertex;
    }
    int	  getPolygonID(void)           const { return(this->mPolygonID);  }
    void  setDestSpcPos(const IntVec3& destspcpos) 
    {
	this->mDestSpcPos = destspcpos;
    }
    const IntVec3& getDestSpcPos(void) const 
    {
	return(this->mDestSpcPos); 
    }
    const Vector3& getIntensity(void)  const 
    {
	return(this->mIntensity);  
    }
    const Vector3& getVertex(void)     const 
    {
	return(this->mVertex);	  
    }
};

#endif				// #ifndef _VertexIntensity_h
