Beispiel #1
0
void FireworkEffect::Init()
{
	m_vSource		= VECTOR3(0.0f, 0.0f, 0.0f);
	m_vWind			= VECTOR3(0.33f, 2.33f, 0.0f);
	
	float r			= GenerateRandomFloat(1.0f);
	float g			= GenerateRandomFloat(1.0f);
	float b			= GenerateRandomFloat(1.0f);

	while (r + g + b < 1.0f)
	{
		r *= 2.0f;
		g *= 2.0f;
		b *= 2.0f;
	}
	
	if (r > 1.0f)
	{
		r = 1.0f;
	}
	if (g > 1.0f)
	{
		g = 1.0f;
	}
	if (b > 1.0f)
	{
		b = 1.0f;
	}

	m_vColor		= VECTOR3(r, g, b);
}
Beispiel #2
0
//=============================================================================
// 初期化
//=============================================================================
bool CPlayerCamera::Init(void)
{
	CGraphicManager* graphic_manager = interface_manager_->graphic_manager();
	WINDOW_DATA* window_data = interface_manager_->window_data();
	CCameraManager* camera_manager = graphic_manager->camera_manager();
	camera_key_ = camera_manager->CreateCamera();
	CCamera* camera = camera_manager->GetCamera(camera_key_);

	// 初期化失敗
	if(!camera->Init())
	{
		// 作ったカメラを削除
		camera_manager->EraseCamera(camera_key_);
		return false;
	}

	// 初期座標の設定
	camera->SetPosition(VECTOR3(0.0f,10.0f,200.0f),VECTOR3(0.0f,0.0f,0.0f));

	// パースペクティブの設定
	camera->SetPerspective(60.0f,((f32)(window_data->_width) / window_data->_height),1.0f,10000.0f);

	move_speed_ = 1.0f;

	length_ = 100.0f;

	return true;
}
Beispiel #3
0
////////////////////////////////////////////////////////////////////////////////////////
//GetBBox
//--------
//Get a box which is twice as bigger as the boundding box of the  object
//
void TMesh::GetBBox()
{
    if(v_count() == 0 ) {
        _pmin = VECTOR3();
        _pmax = VECTOR3();
        return;
    }

    for(int i = 0; i < 3; i ++) {
        _pmin[i] = (vertex(0).coord())(i);
        _pmax[i] = (vertex(0).coord())(i);
    }

    for(unsigned int i = 1; i < v_count(); i ++) {
        for(int j = 0; j < 3; j ++) {
            if( (vertex(i).coord())(j) < _pmin[j] )
                _pmin[j] = (vertex(i).coord())(j);
            else if((vertex(i).coord())(j) > _pmax[j])
                _pmax[j] = (vertex(i).coord())(j);
        }//for j
    }//for i


    //cerr<<"BBox: min "<<_pmin[0]<<" "<<_pmin[1]<<" "<<_pmin[2]
    //<<" max "<<_pmax[0]<<" "<<_pmax[1]<<" "<<_pmax[2]<<endl;
}
Beispiel #4
0
void CEffect2D::Resize(void)
{
	Vtx[0] = VECTOR3(_Size.x / 2,-_Size.y / 2.0f,0);
	Vtx[1] = VECTOR3(-_Size.x / 2,-_Size.y / 2.0f,0);
	Vtx[2] = VECTOR3(_Size.x / 2,_Size.y / 2.0f,0);
	Vtx[3] = VECTOR3(-_Size.x / 2,_Size.y / 2.0f,0);
}
Beispiel #5
0
//++++++++++++++++++++++++++++++++++++++++++++++++
//エミッター有効化
//--in--------------------------------------------
//type	:エフェクトタイプ
//obj	:オブジェクトに追従する場合のみobjのポインタ、それ以外はNULL
//--out-------------------------------------------
//
//++++++++++++++++++++++++++++++++++++++++++++++++
void EMITTER::Create(int type, GLuint texID, OBJECT *obj)
{	
	m_Enable = true;
	m_obj = obj;
	m_TexID = texID;
	m_Type = type;

	switch(type)
	{
	case SPIN:
		m_LifeTime = EM_SPIN_TIME;
		m_Color = VECTOR3(0.1f, 0.1f, GetRandom(100,50)/100.0f);		//青
		break;
	case SPLASH:
		m_LifeTime = EM_SPLSH_TIME;
		m_Color = VECTOR3(GetRandom(100,10)/100.0f,
			GetRandom(100,10)/100.0f, 
			GetRandom(100,10)/100.0f);		//青GetRandom(50,10)

		break;
	case BOMB:
		m_LifeTime = EM_BOMB_TIME;
		m_Color = VECTOR3(1.0f, 1.0f, 1.0f);
			//0.7f, 
			//0.1f);		//白
	}
}
Beispiel #6
0
void ProjectileSystem::Update(float _dt)
{
	MouseInputComponent* mouse;
	PositionComponent* position;

	EntityMap::iterator it;
	for (it = m_entityMap.begin(); it != m_entityMap.end(); ++it)
	{
		Entity* e = it->second;
		if (e->GetState() != Entity::ALIVE)
			continue;

		mouse = e->GetComponent<MouseInputComponent>();
		if (mouse->m_controls.LeftButton == InputState::Pressed)
		{
			position = it->second->GetComponent<PositionComponent>();

			Entity* e = m_world->CreateEntity();
			EntityFactory::GetInstance()->CreateEntity(e, EntityFactory::BALL);
			e->GetComponent<VelocityComponent>()->m_velocity = VECTOR3(0, 40, 0);
			e->GetComponent<PositionComponent>()->SetPosition(VECTOR3(position->GetPosition().x, position->GetPosition().y + 2.0f, 0));

			m_world->AddEntity(e);
		}
	}
}
Beispiel #7
0
CMeshCylinder::CMeshCylinder(int priority):CObject(priority)
{
	_Pos = VECTOR3(0,0,0);
	_Rot = VECTOR3(0,0,0);
	Vtx = nullptr;
	Tex = nullptr;
	Nor = nullptr;
}
Beispiel #8
0
CMeshField::CMeshField(int priority):CObject(priority)
{
	_Pos = VECTOR3(0,0,0);
	_Rot = VECTOR3(0,0,0);
	Vtx = nullptr;
	Tex = nullptr;
	Nor = nullptr;
}
Beispiel #9
0
//=============================================================================
// 描画処理
//=============================================================================
void CUserNumber::Draw(void)
{
	CGraphicManager* graphic_manager = interface_manager_->graphic_manager();
	CObjectManager* object_manager = graphic_manager->object_manager();
	CObject3DManager* object_3d_manager = object_manager->object_3d_manager();
	char* filename = NULL;
	// 描画
	object_3d_manager->Draw(object_key_,position_,VECTOR3(),VECTOR3(1.0f,1.0f,1.0f),MATRIX4x4(),texture_name_);
}
Beispiel #10
0
//==============================================================================
// 着弾地点判定
//==============================================================================
void CGame::HitBulletToField(void)
{
	VECTOR3		nor;
	float		height;
	CBillboard* mark;
	VECTOR3		markPos;
	CBallistic* ballistic = Player[CManager::netData.charNum]->GetBallistic();
	CPolygon3D* landing = ballistic->GetLanding();

	for(int cnt = 0; cnt < MARK_MAX; ++cnt)
	{
		// 初期化
		nor = VECTOR3(0.0f,0.0f,0.0f);
		height = 0.0f;

		// マーク情報
		mark = ballistic->GetMark(cnt);
		markPos = mark->Pos();

		// 高さ判定
		height = Ground->GetHeight(markPos - VECTOR3(0.0f, BULLET_SIZE * 0.5f, 0.0f), &nor);
		if(height >= markPos.y)
		{
			// 回転を求める
			VECTOR3	vectorUp(0.0f, 1.0f, 0.0f);		// 上方向ベクトル
			VECTOR3	vectorAxisRotation;				// 回転軸
			float	rotation = 0.0f;				// 回転量
			VECTOR3::Cross(&vectorAxisRotation, nor, vectorUp);
			if (vectorAxisRotation.x < FLT_EPSILON && vectorAxisRotation.x > -FLT_EPSILON)
			{
				if (vectorAxisRotation.z < FLT_EPSILON && vectorAxisRotation.z > -FLT_EPSILON)
				{
					if (vectorAxisRotation.y < FLT_EPSILON && vectorAxisRotation.y > -FLT_EPSILON)
					{
						vectorAxisRotation.y = 1.0f;
					}
				}
			}
			vectorAxisRotation.Normalize();
			rotation = VECTOR3::Dot(nor, vectorUp);
			if (rotation <= 1.0f && rotation >= -1.0f)
			{
				rotation = RAD_TO_DEG * acosf(rotation);
			}
			else
			{
				rotation = 0.0f;
			}

			// 着弾マークに設定する
			landing->SetPos(VECTOR3(markPos.x, height + 0.5f, markPos.z));
			landing->SetAxisRotation(vectorAxisRotation);
			landing->SetRotationAxis(rotation);
			break;
		}
	}
}
Beispiel #11
0
void CFade::Initialize(void)
{
	Self = new CFade;
	Self->Vtx[0] = VECTOR3(SCREEN_WIDTH,0,0);
	Self->Vtx[1] = VECTOR3(0,0,0);
	Self->Vtx[2] = VECTOR3(SCREEN_WIDTH,SCREEN_HEIGHT,0);
	Self->Vtx[3] = VECTOR3(0,SCREEN_HEIGHT,0);
	Self->_Color = BLACK(1.0f);
	Self->_State = FADE_NONE;
}
Beispiel #12
0
bool GraphicsManager::InitWindow(int _x, int _y, int _width, int _height, DisplayMode _displayMode)
{

	m_ICamera = ICamera::GetICamera(45.0f, _width, _height, 0.1f, 100.0f);
	m_ICamera->SetPosition(VECTOR3(0, 0, 10));

	m_ICamera->SetLookAt(VECTOR3(0, 0, 0));

	m_ICamera->SetViewPort(0, 0, _width, _height);
	return m_IGraphics->InitWindow(_x, _y, _width, _height, _displayMode);
}
Beispiel #13
0
//=============================================================================
//初期化
//=============================================================================
void CEffect2D::Init(void)
{
	TEX_INFO tex;
	Length = sqrtf((_Size.x / 2)*(_Size.x / 2) + (_Size.y / 2)*(_Size.y / 2));
	Angle = atan2f(_Size.x / 2,_Size.y / 2);

	Vtx[0] = VECTOR3(_Size.x / 2,-_Size.y / 2.0f,0);
	Vtx[1] = VECTOR3(-_Size.x / 2,-_Size.y / 2.0f,0);
	Vtx[2] = VECTOR3(_Size.x / 2,_Size.y / 2.0f,0);
	Vtx[3] = VECTOR3(-_Size.x / 2,_Size.y / 2.0f,0);


}
Beispiel #14
0
void CMeshCylinder::Init(void)
{
	IndexNum =		(int)(SUM_INDEX(PanelNum.x,PanelNum.y));
	VertexNum =		(int)((PanelNum.x+1)*(PanelNum.y+1));
	PolygonNum =	(int)(((PanelNum.x*2)*PanelNum.y)+((PanelNum.y-1)*4));

	Vtx = new VECTOR3[VertexNum];
	Tex = new VECTOR2[VertexNum];
	Nor = new VECTOR3[VertexNum];

	float angle = (360.0f/PanelNum.x)*(PI/180.0f);

	for(int LoopZ=0,num=0;LoopZ<PanelNum.y+1;LoopZ++)
	{
		for(int LoopX=0;LoopX<PanelNum.x+1;LoopX++)
		{
			Vtx[num] = VECTOR3(cosf(angle*LoopX)*Radius,PanelHeight*LoopZ,sinf(angle*LoopX)*Radius);
			Tex[num] = VECTOR2((TexDiv.x/PanelNum.x)*LoopX,(TexDiv.x/PanelNum.x)*LoopZ);
			
			Nor[num] = VECTOR3(sinf(angle*LoopX),0.0f,cosf(angle*LoopX));
			Nor[num].Normalize();
			_Color = COLOR(1.0f,1.0f,1.0f,1.0f);
			num++;
		}
	}

	int LoopX=0;
	int VtxNo = 0;
	Index = new int[IndexNum];
	
	for(int LoopZ=0;LoopZ<PanelNum.y;LoopZ++)
	{
		if(LoopZ != 0)
		{
			LoopX = 0;
			Index[VtxNo] = (int)((LoopZ*(PanelNum.x+1))+(((LoopX+1)%2)*(PanelNum.x+1)+(LoopX/2)));
			VtxNo++;
		}
		for(LoopX=0;LoopX<(PanelNum.x+1)*2;LoopX++)
		{
			Index[VtxNo] = (int)((LoopZ*(PanelNum.x+1))+(((LoopX+1)%2)*(PanelNum.x+1)+(LoopX/2)));
			VtxNo++;
		}
		if(LoopZ==PanelNum.y-1)
		{
			break;
		}
		Index[VtxNo] = Index[VtxNo-1];
		VtxNo++;
	}
}
Beispiel #15
0
//++++++++++++++++++++++++++++++++++++++++++++++++
//初期化
//--in--------------------------------------------
//
//--out-------------------------------------------
//
//++++++++++++++++++++++++++++++++++++++++++++++++
void EMITTER::Init()
{
	m_ParticleCount = 0;
	m_Enable = false;
	m_Pos	= VECTOR3(0.0f, 0.0f, 0.0f);
	m_LifeTime = 0;
	m_Color = VECTOR3(1.0f, 1.0f, 1.0f);
	
	for(int i = 0; i < MAX_PARTICLE; i++)
	{
		m_Particle[i].Init();
	}

}
Beispiel #16
0
void CMeshField::Init(void)
{
	IndexNum =		(int)(SUM_INDEX(PanelNum.x,PanelNum.y));
	VertexNum =		(int)((PanelNum.x+1)*(PanelNum.y+1));
	PolygonNum =	(int)(((PanelNum.x*2)*PanelNum.y)+((PanelNum.y-1)*4));

	Vtx = new VECTOR3[VertexNum];
	Tex = new VECTOR2[VertexNum];
	Nor = new VECTOR3[VertexNum];
	

	float OffsetX = (PanelNum.x*PanelSize.x)/2;
	float OffsetZ = (PanelNum.y*PanelSize.y)/2;

	for(int LoopZ=0,num=0;LoopZ<PanelNum.y+1;LoopZ++)
	{
		for(int LoopX=0;LoopX<PanelNum.x+1;LoopX++)
		{
			Vtx[num] = VECTOR3(OffsetX+(-PanelSize.x*LoopX),0,-OffsetZ+(PanelSize.y*LoopZ));
			Tex[num] = VECTOR2((float)LoopX,(float)LoopZ);
			Nor[num] = VECTOR3(0,1.0f,0);
			_Color = COLOR(1.0f,1.0f,1.0f,1.0f);
			num++;
		}
	}

	int LoopX=0;
	int VtxNo = 0;
	Index = new int[IndexNum];
	for(int LoopZ=0;LoopZ<PanelNum.y;LoopZ++)
	{
		if(LoopZ != 0)
		{
			LoopX = 0;
			Index[VtxNo] = (int)((LoopZ*(PanelNum.x+1))+(((LoopX+1)%2)*(PanelNum.x+1)+(LoopX/2)));
			VtxNo++;
		}
		for(LoopX=0;LoopX<(PanelNum.x+1)*2;LoopX++)
		{
			Index[VtxNo] = (int)((LoopZ*(PanelNum.x+1))+(((LoopX+1)%2)*(PanelNum.x+1)+(LoopX/2)));
			VtxNo++;
		}
		if(LoopZ==PanelNum.y-1)
		{
			break;
		}
		Index[VtxNo] = Index[VtxNo-1];
		VtxNo++;
	}
}
Beispiel #17
0
//-----------------------------------------------------------------------------
// Name : iwfSurface () (Alternate Constructor)
// Desc : iwfSurface Class Constructor, adds specified number of vertices
//-----------------------------------------------------------------------------
iwfSurface::iwfSurface( USHORT Count )
{
	// Reset / Clear all required values
    Components          = 0;
    Normal              = VECTOR3( 0.0f, 0.0f, 0.0f );
    ZBias               = 0;
    Style               = 0;
    RenderEffect        = -1;
    ChannelCount        = 0;
    TextureIndices      = NULL;
    MaterialIndices     = NULL;
    ShaderIndices       = NULL;
    BlendModes          = NULL;
    CustomDataSize      = 0;
    CustomData          = NULL;
    
    VertexComponents    = 0;
    VertexFlags         = 0;
    VertexCount         = 0;
    TexChannelCount     = 0;
    TexCoordSize        = NULL;

    IndexVPool          = 0;
    IndexFlags          = 0;
    IndexCount          = 0;
    
    Vertices            = NULL;
    Indices             = NULL;

    // Add vertices
    AddVertices( Count );
}
VECTOR3 Math::Vec3_Cross(const VECTOR3& vec1, const VECTOR3& vec2)
{
	return VECTOR3(
		vec1.y*vec2.z - vec1.z*vec2.x,
		vec1.z*vec2.x - vec1.x*vec2.z,
		vec1.x*vec2.y - vec1.y*vec2.x);
};
Beispiel #19
0
//++++++++++++++++++++++++++++++++++++++++++++++++
//パーティクルの生成
//--in--------------------------------------------
//	開始位置
//--out-------------------------------------------
//	なし
//++++++++++++++++++++++++++++++++++++++++++++++++
void LINE_PARTICLE::Gen(void)
{
	VECTOR3 v;
	VECTOR3 vWork;		//表示位置計算用ワーク
		//表示位置計算
	vWork = m_Obj->m_Pos + VECTOR3(m_Obj->m_MatrixRot._31, 0.0f, m_Obj->m_MatrixRot._33) * m_Obj->m_Width / 2.0f;

	//m_ObjRad = VectoVec(vWork, VECTOR3(0.0f, 0.0f, 1.0f));
	vWork.y = 1.0f;
	m_Pos = vWork;


	for(int i = 0; i < LINE_NUM; i++)
	{
		if(m_Time[i] > 0)
			continue;
		m_Time[i] = LINE_PARTICLE_TIME;
		m_Alpha[i] = 1.0f;
		m_Scale[i] = GetRandom(20,3) / 100.0f;
		m_RadY[i] = GetRandom(360,0) * M_PI / 180.0f;
		m_RadX[i] = (GetRandom(180,0) - 90) * M_PI / 180.0f;
		//m_dsp[i] = true;
		m_TexOffset[i] = GetRandom(50,0) / 100.0f;
		break;
	}

}
Beispiel #20
0
void Shield::Init()
{
	m_fCurrentFade		= 0.0f;
	m_fFadeTime			= 0.2f;
	m_vColor			= VECTOR3(1.0f, 1.0f, 1.0f); //default white
	m_pNode				= 0;
	m_bActive			= false;
}
Beispiel #21
0
//------------------------------------------------------------------------------
// コンストラクタ
//------------------------------------------------------------------------------
// 引数
//  なし
//------------------------------------------------------------------------------
CBullet::CBullet():CBillboard()
{
	// 速度
	Movement = VECTOR3(0.0f, 0.0f, 0.0f);

	// テクスチャ
	Texture = CTexture::Texture(TEX_BULLET);
	SetUV(0,0,1.0f,1.0f);
}
Beispiel #22
0
void
CLineRenderer::_ComputeNormal
	(
		const VECTOR3& v3Tangent, 
		VECTOR3& v3Normal
	)
{
	int iMinDir = 0;
	for(int i = 1; i < 3; i++)
		if( fabsf(v3Tangent[iMinDir]) > fabsf(v3Tangent[i]) )
			iMinDir = i;
	switch(iMinDir)
	{
	case 0:	v3Normal = VECTOR3(0.0f, -v3Tangent[2], v3Tangent[1]);	break;
	case 1:	v3Normal = VECTOR3(-v3Tangent[2], 0.0f, v3Tangent[0]);	break;
	case 2:	v3Normal = VECTOR3(-v3Tangent[1], v3Tangent[0], 0.0f);	break;
	}
}
inline VECTOR3 IRenderPipeline3D::mFunction_SampleTexture(float x, float y)
{
	//texture mapping disabled, diffuse color will be taken from material
	if (m_pTexture == nullptr)return VECTOR3(1.0f, 1.0f, 1.0f);

	//wrap-mode
	UINT width = m_pTexture->GetWidth();
	UINT height = m_pTexture->GetHeight();
	float pixelX= abs(width * (float(x - UINT(x))));
	float pixelY = abs(height * (float(y - UINT(y))));
	return m_pTexture->GetPixel(UINT(pixelX), UINT(pixelY));
}
/// Setup the transform from one joint to another
void FIXEDJOINT::setup_joint()
{
  const unsigned X = 0, Y = 1, Z = 2;
  shared_ptr<const POSE3> GLOBAL;

  // get the two poses 
  shared_ptr<const POSE3> inboard = get_inboard_pose();
  shared_ptr<const POSE3> outboard = get_outboard_pose();
  if (!inboard || !outboard)
    return;

  // get the rotation matrices
  MATRIX3 Ri = inboard->q;
  MATRIX3 Ro = outboard->q;

  // TODO: fix this
  // compute the relative transform
/*
  MATRIX3 Rrel = MATRIX3::transpose(Ro) * Ri;
  _T->q = Rrel;
  _T->x.set_zero();
  _T->source = ;

  // compute the vector from the inner link to the outer link in inner link
  // frame
  VECTOR3 ox(outboard->x, To);
//  _ui = inboard->inverse_transform(ox);
*/
  // compute the constant orientation term
  _rconst[X] = VECTOR3(Ri.get_row(X), GLOBAL).dot(VECTOR3(Ro.get_row(X), GLOBAL));
  _rconst[Y] = VECTOR3(Ri.get_row(Y), GLOBAL).dot(VECTOR3(Ro.get_row(Y), GLOBAL));
  _rconst[Z] = VECTOR3(Ri.get_row(Z), GLOBAL).dot(VECTOR3(Ro.get_row(Z), GLOBAL));
}
Beispiel #25
0
//=============================================================================
//	プレイヤー情報のセット関数
//=============================================================================
void CGame::SetPlayerState(NET_DATA _netData,DATA_TYPE _dataType)
{
	//	自分以外のデータなら
	if (_netData.charNum != CManager::netData.charNum)
	{
		switch (_dataType)
		{
		case DATA_TYPE_POS:

			Player[_netData.charNum]->SetDestPosX(_netData.data_pos.posX);
			Player[_netData.charNum]->SetDestPosY(_netData.data_pos.posY);
			Player[_netData.charNum]->SetDestPosZ(_netData.data_pos.posZ);

			break;

		case DATA_TYPE_ROT:

			/*Player[_netData.charNum]->SetAxisRotation(VECTOR3(_netData.data_rot.X, _netData.data_rot.Y, _netData.data_rot.Z));
			Player[_netData.charNum]->SetRotationAxis(_netData.data_rot.rot);
			Player[_netData.charNum]->SetRotY(_netData.data_rot.yRotation);*/
  Player[_netData.charNum]->SetDestRotY(_netData.data_rot.rotY);
			break;

		case DATA_TYPE_CANNONROT:

			Player[_netData.charNum]->setBarrelDestRot(
				VECTOR3(_netData.data_cannonRot.rotX,
				_netData.data_cannonRot.rotY,
				_netData.data_cannonRot.rotZ
				));

			break;

		case DATA_TYPE_CANNON:

			if (_netData.data_cannon.flag == true)
			{
				Player[_netData.charNum]->BlastBullet();
			}

			break;

		case DATA_TYPE_DEATH:

			break;

		case DATA_TYPE_KILL:

			break;
		}
	}
}
Beispiel #26
0
void UIScroller::Init()
{
	m_dwMaxDisplayable		= 7;
	m_dwMinDisplayed		= 0;
	m_bCircular				= false;
	m_bRenderWithBlending	= false;

	m_fTimeLeftToScroll		= 0.0f;
	m_fTimePerScroll		= 0.6f;

	m_dwSelected			= -1;

	m_vDimensions			= VECTOR3(1.0f, 1.0f, 1.0f);
}
Beispiel #27
0
//++++++++++++++++++++++++++++++++++++++++++++++++
//リセット
//--in--------------------------------------------
//
//--out-------------------------------------------
//
//++++++++++++++++++++++++++++++++++++++++++++++++
void IMPACT::Reset()
{	

	m_Live = false;
	m_Pos = VECTOR3(0.0f, 0.0f, 0.0f);
	for(int i = 0; i < IMPACT_NUM; i++)
	{
		m_Time[i] = IMPACT_TIME;
		m_Alpha[i] = 0.0f;
		m_Scale[i] = 0.1f;
	}
	m_ScaleRate = 0.0f;

}
Beispiel #28
0
//==============================================================================
// 地形との判定
//==============================================================================
void CGame::IsLandField(void)
{
	// 判定
	VECTOR3	 nor;			// 法線
	float	 height;		// 高さ
	VECTOR3	 bulletPos;		// 対象オブジェクト座標

	CPlayer* pPlayerCurrent = nullptr;		// 対象プレイヤー

	for (int cntBullet = 0; cntBullet < PLAYER_MAX; ++cntBullet)
	{
		// 対象プレイヤーの取得
		pPlayerCurrent = Player[cntBullet];

		// 弾が存在しなければ判定しない
		if (NeedsSkipBullet(pPlayerCurrent))
		{
			continue;
		}

		// 対象オブジェクト座標を取得
		bulletPos = pPlayerCurrent->Bullet()->Pos();

		// 判定
		height = Ground->GetHeight(bulletPos - VECTOR3(0.0f, BULLET_SIZE * 0.5f, 0.0f), &nor);
		if (height >= bulletPos.y)
		{
			// 弾の消滅処理
			CSoundAL::Play(CSoundAL::SE_IMPACT, bulletPos);
			pPlayerCurrent->ReleaseBullet();

			// エフェクト:爆発 弾と地形の判定
			CSmoke::Create(VECTOR3(bulletPos.x, height, bulletPos.z));
		}
	}
}
void IRenderPipeline3D::VertexShader(Vertex& inVertex)
{
	VertexShaderOutput_Vertex outVertex;

	//vertex position
	VECTOR4 pos(inVertex.pos.x, inVertex.pos.y, inVertex.pos.z, 1.0f);
	pos = Matrix_Multiply(mWorldMatrix, pos);
	pos = Matrix_Multiply(mViewMatrix, pos);

	//non-linear operation
	float Z_ViewSpace = pos.z;
	pos = Matrix_Multiply(mProjMatrix, pos);
	if (Z_ViewSpace >= 0)
	{
		pos.x /= (Z_ViewSpace);
		pos.y /= (Z_ViewSpace);
	}

	outVertex.posH = pos;

	//Normal also need transformation,actually it need a World-Inverse-Transpose
	//But I rule out all non-Orthogonal Transformation, so inverse can just use Transpose to substitude
	//thus inverse-transpose yields world matrix itself(without translation)
	MATRIX4x4 WorldMat_NoTrans = mWorldMatrix;
	WorldMat_NoTrans.SetColumn(3, { 0,0,0,1.0f });
	VECTOR4 normW(inVertex.normal.x, inVertex.normal.y, inVertex.normal.z, 1.0f);
	normW = Matrix_Multiply(WorldMat_NoTrans, normW);


	//-----TexCoord
	outVertex.texcoord = VECTOR2(
		inVertex.texcoord.x*mTexCoord_scale + mTexCoord_offsetX, 
		inVertex.texcoord.y*mTexCoord_scale + mTexCoord_offsetY);


	//...Vertex Light or directly use vertex color
	if (mLightEnabled)
	{
		outVertex.color = mFunction_VertexLighting(inVertex.pos, VECTOR3(normW.x,normW.y,normW.z));
	}
	else
	{
		outVertex.color = inVertex.color;
	}

	m_pVB_HomoSpace->push_back(outVertex);
}
Beispiel #30
0
//++++++++++++++++++++++++++++++++++++++++++++++++
//リセット
//--in--------------------------------------------
//
//--out-------------------------------------------
//
//++++++++++++++++++++++++++++++++++++++++++++++++
void LINE_PARTICLE::Reset()
{	

	m_Live = false;
	m_Pos = VECTOR3(0.0f, 0.0f, 0.0f);
	for(int i = 0; i < LINE_NUM; i++)
	{
		m_Time[i] = 0;
		m_Alpha[i] = 1.0f;
		m_Scale[i] = 0.0f;
		m_RadY[i] = 0.0f;
		m_RadX[i] = 0.0f;
		m_TexOffset[i] = 0.0f;
	}
	m_ScaleRate = 0.0f;
	m_Obj = NULL;
}