Exemple #1
0
//////////////////////////////////////////////////////////////////////////
// markupResources
void CsPackageLoader::markupResources()
{
	// Use this to advance as we need.
	BcU8* pCurrPackageData = reinterpret_cast< BcU8* >( pPackageData_ ) + Header_.ResourceDataStart_;

	// Allocate chunks.
	for( BcU32 ChunkIdx = 0; ChunkIdx <= Header_.TotalChunks_; ++ChunkIdx )
	{
		CsPackageChunkHeader& ChunkHeader( pChunkHeaders_[ ChunkIdx ] );
		CsPackageChunkData& ChunkData( pChunkData_[ ChunkIdx ] );

		if( ChunkHeader.Flags_ & csPCF_MANAGED )
		{
			ChunkData.Managed_ = BcTrue;
			ChunkData.pUnpackedData_ = pCurrPackageData;

			// Advance package data.
 			pCurrPackageData += BcCalcAlignment( ChunkHeader.UnpackedBytes_, ChunkHeader.RequiredAlignment_ );

#if PSY_DEBUG
			// Clear memory.
			BcMemSet( ChunkData.pUnpackedData_, 0x11, ChunkHeader.UnpackedBytes_ );
#endif
		}
		else
		{
			ChunkData.Managed_ = BcFalse;
		}
	}
}
Exemple #2
0
OpenGLWidget::OpenGLWidget(QWidget * parent) :
    QOpenGLWidget(parent),
    m_glFuncs(nullptr),
    m_vertexBuffer(QOpenGLBuffer::VertexBuffer),
    m_indexBuffer(QOpenGLBuffer::IndexBuffer),
    m_texture(QOpenGLTexture::Target2D),
    m_forwardSpeed(0.0f),
    m_strafeSpeed(0.0f),
    m_upSpeed(0.0f),
    m_cameraPosition(0.0f, 60.0f, 20.0f),
    m_cameraFront(0.0f, 0.0f, -1.0f),
    m_yawRotation(0.0f),
    m_pitchRotation(0.0f)
{
    this->setMouseTracking(true);

    QFile f(":/misc/ChunkDump.bin");
    f.open(QFile::ReadOnly);

    m_chunkData = ChunkData(16, 256, 16);

    for(int y = 0; y < 256; ++y)
    {
        for(int z = 0; z < 16; ++z)
        {
            for(int x = 0; x < 16; ++x)
            {
                char c;
                f.getChar(&c);
                m_chunkData.setBlock(x, y, z, c);
            }
        }
    }

    m_chunkMesh = ChunkMesh::createFromChunkData(m_chunkData);}
Exemple #3
0
//////////////////////////////////////////////////////////////////////////
// findResourceChunk
BcBool CsPackageLoader::findResourceChunk( void* pData, BcU32& ResourceIdx, BcU32& ChunkIdx )
{
	for( ResourceIdx = 0; ResourceIdx < Header_.TotalResources_; ++ResourceIdx )
	{
		CsPackageResourceHeader& ResourceHeader( pResourceHeaders_[ ResourceIdx ] );
		
		for( ChunkIdx = ResourceHeader.FirstChunk_; ChunkIdx <= ResourceHeader.LastChunk_; ++ChunkIdx )
		{
			CsPackageChunkData& ChunkData( pChunkData_[ ChunkIdx ] );

			// If the pointer matches the packed or unpacked data
			if( ChunkData.pPackedData_ == pData || ChunkData.pUnpackedData_ == pData )
			{
				return BcTrue;
			}
		}
	}

	return BcFalse;
}