Example #1
0
	void CBundle::Start()
	{
		THREAD_ANY();

		CheckValid();

		if(m_state == eBndlState_Uninstalled)
			throw "IllegalStateException";

		if(m_state == eBndlState_Starting || m_state == eBndlState_Stopping)
			throw "Wait for finished";

		if(m_state == eBndlState_Active)
			return;

		if(m_state == eBndlState_Installed)
		{
			Resolve();
			if(m_state != eBndlState_Resolved)
				throw "BundleException";
		}

		PreStart();
		if(m_state != eBndlState_Starting)
			throw "BundleException";

		if(m_activator)
		{
			try
			{
				m_activator->Start(m_context);
			}
			catch(...)
			{
				PreStop();
				PostStop(false, false);
				throw "BundleException";
			}

			if(m_state == eBndlState_Uninstalled)
				throw "BundleException";
		}

		PostStart();
	}
void CShockWaveEffect::Start(FLOAT time, BOOL restart)
{
	INDEX	i;
	if(!PreStart(time, restart)) return;
	if(m_eState != ES_NOT_STARTED) return;

	ASSERT(m_iSplitCount >= 8);

	ClearInstance();

	//vertex index, once
	m_vectorIndex.reserve(m_iSplitCount * 2 * 3);
	for( i=0; i<m_iSplitCount-1; ++i)
	{
		m_vectorIndex.push_back(2 * i + 0);
		m_vectorIndex.push_back(2 * i + 2);
		m_vectorIndex.push_back(2 * i + 1);
		m_vectorIndex.push_back(2 * i + 1);
		m_vectorIndex.push_back(2 * i + 2);
		m_vectorIndex.push_back(2 * i + 3);
	}
	m_vectorIndex.push_back(2 * (m_iSplitCount-1) + 0);
	m_vectorIndex.push_back(0);
	m_vectorIndex.push_back(2 * (m_iSplitCount-1) + 1);
	m_vectorIndex.push_back(2 * (m_iSplitCount-1) + 1);
	m_vectorIndex.push_back(0);
	m_vectorIndex.push_back(1); 

	//move vector fill, once
	m_vectorMoveVector.reserve(m_iSplitCount * 2);
	const FLOAT angleUnit = 2 * PI / m_iSplitCount;
	FLOAT angle = 0;
	for( i = 0; i < m_iSplitCount; ++i)
	{
		m_vectorMoveVector.push_back( FLOAT3D( sinf(angle), 0, cosf(angle) ) );
		m_vectorMoveVector.push_back( FLOAT3D( sinf(angle), 0, cosf(angle) ) );
		angle += angleUnit;
	}

	//tex coord fill, once
	m_vectorTexCoord.reserve(m_iSplitCount * 2);
	GFXTexCoord texcrd1, texcrd2, texcrd3, texcrd4;
	texcrd1.s = 0.05f;
	texcrd1.t = 0.05f;
	texcrd2.s = 0.05f;
	texcrd2.t = 0.95f;
	texcrd3.s = 0.95f;
	texcrd3.t = 0.05f;
	texcrd4.s = 0.95f;
	texcrd4.t = 0.95f;
	for( i = 0; i < m_iSplitCount; ++i)
	{
		if(i % 2 == 0)
		{
			m_vectorTexCoord.push_back(texcrd1);
			m_vectorTexCoord.push_back(texcrd2);
		}
		else
		{
			m_vectorTexCoord.push_back(texcrd3);
			m_vectorTexCoord.push_back(texcrd4);
		}
	}

	m_ssRadius.Prepare();
	m_ssWidth.Prepare();
	m_ssHeight.Prepare();

	//first state gfx vertex filll, fir frame
	FLOAT height = m_ssHeight.Value(0);
	FLOAT radiusInner = 0, radiusOuter = 0;
	if(m_bInnerBasis)
	{
		radiusInner = m_ssRadius.Value(0);
		radiusOuter = radiusInner + m_ssWidth.Value(0);
	}
	else
	{
		radiusOuter = m_ssRadius.Value(0);
		radiusInner = radiusOuter - m_ssWidth.Value(0);
	}

	m_vectorGFXVertex.clear();
	m_vectorGFXVertex.reserve(m_iSplitCount * 2);

	//tag의 정보
	m_vTagPos = m_ptrAttachTag->CurrentTagInfo().m_vPos;
	if(m_eRotation != EOTT_NONE) m_qTagRot = m_ptrAttachTag->CurrentTagInfo().m_qRot;

	//gfx vertex fill, every frame
/*
	GFXVertex vtx;
	FLOAT3D pos;
	angle = 0;
	for(i=0; i<m_iSplitCount; ++i)
	{
		pos = m_vectorMoveVector[2*i+0] * radiusOuter;
		RotateVector(pos, rotTag);
		pos += posTag;
		vtx.x = pos(1);	vtx.y = pos(2);	vtx.z = pos(3);
		m_vectorGFXVertex.push_back(vtx);

		pos = m_vectorMoveVector[2*i+1] * radiusInner;
		RotateVector(pos, rotTag);
		pos += posTag;
		vtx.x = pos(1);	vtx.y = pos(2);	vtx.z = pos(3);
		m_vectorGFXVertex.push_back(vtx);
		angle += angleUnit;
	}

	//gfx color fill, once
	GFXColor col;
	for(i=0; i<m_iSplitCount; ++i)
	{
		col.Set(0xFFFFFFFF);
		m_vectorGFXColor.push_back(col);
		m_vectorGFXColor.push_back(col);
	}
*/
	m_bColorWhite = TRUE;

	PostStart();
}