Esempio n. 1
0
//////////////////////////////////////////////////////////////////////////
// getDepth
BcU32 ScnViewComponent::getDepth( const MaVec3d& WorldPos ) const
{
	MaVec4d ScreenSpace = MaVec4d( WorldPos, 1.0f ) * ViewUniformBlock_.ClipTransform_;
	BcF32 Depth = 1.0f - BcClamp( ScreenSpace.z() / ScreenSpace.w(), 0.0f, 1.0f );

	return BcU32( Depth * BcF32( 0xffffff ) );
}
Esempio n. 2
0
//////////////////////////////////////////////////////////////////////////
// addVertexShared
BcU32 MdlMesh::addVertexShared( const MdlVertex& Vertex )
{
	// Go through all our vertices, and if we find a matching one,
	// return the index to it, else just add this vert and return
	// the index to it.
	BcU32 iVertex = 0;
	BcBool bFoundVertex = BcFalse;

	for( BcU32 i = 0; i < aVertices_.size(); ++i )
	{
		// If we find the vertex, we can bail.
		if( compareVertices( Vertex, aVertices_[ i ] ) )
		{
			iVertex = i;
			bFoundVertex = BcTrue;
			break;
		}
	}

	// If we didn't find a vertex then add it.
	if( bFoundVertex == BcFalse )
	{
		addVertex( Vertex );
		iVertex = BcU32( aVertices_.size() ) - 1;
	}

	return iVertex;
}
Esempio n. 3
0
//////////////////////////////////////////////////////////////////////////
// interpolatedNoise
BcF32 BcRandom::interpolatedNoise( BcF32 X, BcU32 Width )
{
	BcU32 iX = BcU32( X );
	BcF32 FracX = X - iX;
	BcF32 V1 = smoothedNoise( (BcF32)iX, Width );
	BcF32 V2 = smoothedNoise( (BcF32)iX + 1.0f, Width );
	return V1 + ( V2 - V1 ) * FracX;
}
//////////////////////////////////////////////////////////////////////////
// serialiseToBinary
BcBool ReClassSerialiser_StringType::serialiseToBinary( const void* pInstance, BcBinaryData::Stream& Serialiser ) const
{
	const BaseType& Value( *reinterpret_cast< const BaseType* >( pInstance ) );
	Serialiser << BcU32( Value.length() );
	for( size_t Idx = 0; Idx < Value.length(); ++Idx )
	{
		Serialiser << Value[ Idx ];
	}
	return true;
}
Esempio n. 5
0
//////////////////////////////////////////////////////////////////////////
// Ctor
SysKernel::SysKernel( BcReal TickRate ):
	JobQueue_( BcMax( BcGetHardwareThreadCount(), BcU32( 1 ) ) ),
	TickRate_( TickRate )
{
	ShuttingDown_ = BcFalse;
	SleepAccumulator_ = 0.0f;
	FrameTime_ = 0.0f;

	// Set user mask to the workers we have.
	SysKernel::USER_WORKER_MASK = ( ( 1 << JobQueue_.workerCount() ) - 1 );
}