Exemplo n.º 1
0
static void buildTree(SampleNode *pRoot)
{
   SampleNode *pVisualRoot, *pFood, *pNonFood, *pStreams, *pAudio;

   pVisualRoot = createNode(pRoot, "root", "root");

   pFood = createNode(pVisualRoot, "food", "Some food");
   createNode(pFood, "parsley", "tasty herb");
   createNode(pFood, "salad", "eat a lot of it!");

   pNonFood = createNode(pVisualRoot, "non-food", "tech stuff");

   pAudio = createNode(pNonFood, "audio", "ask Lawo");
   createGain(pAudio);
   createVolume(pAudio);
   createFormat(pAudio);
   createNode(pAudio, "dangling", NULL);

   pStreams = createNode(pNonFood, "streams", "see 'em move");
   pStreams->node.pSchemaIdentifiers = stringDup("de.l-s-b.emberplus.samples.streams");
   pStreams->fields |= GlowFieldFlag_SchemaIdentifier;
   createStream1(pStreams);
   createStream2(pStreams);
   createStream3(pStreams);
   createStream4(pStreams);
}
Exemplo n.º 2
0
int Z_Init(void)
{
    zoneMutex = Sys_CreateMutex("ZONE_MUTEX");

    // Create the first volume.
    createVolume(MEMORY_VOLUME_SIZE);
    return true;
}
Exemplo n.º 3
0
Experimental3DVolume::Experimental3DVolume(vtkImageData *image)
    : m_alternativeImage(0), m_finiteDifferenceGradientEstimator(0), m_4DLinearRegressionGradientEstimator(0)
{
    createImage(image);
    createVolumeRayCastFunctions();
    createVoxelShaders();
    createMappers();
    createProperty();
    createVolume();
}
Exemplo n.º 4
0
bool Application::setup()
{
	Ogre::OverlayManager::getSingleton().getByName("InfoPanel")->show();
	
	m_NXOgreScene->getMaterial(0)->setStaticFriction(0.5);
	m_NXOgreScene->getMaterial(0)->setDynamicFriction(0.5);
	m_NXOgreScene->getMaterial(0)->setRestitution(0.1);

	createCharacter();

	createVolume();

	createBasicScenary();

	createTriangleMeshes();

	createConvexes();
	
	return true;
}
Exemplo n.º 5
0
// OpenGL initialization
void Engine::initialize()
{
	std::cout << "INITA" << std::endl;

/*
	_GUIContext = _window->openglContext();
	_GLContext = new QOpenGLContext();
*/

	_GUIContext = _window->openglContext();
	_GLContext = new QOpenGLContext();

	_format = new QSurfaceFormat();
	_format->setRenderableType(QSurfaceFormat::RenderableType::OpenGL);
	_format->setMajorVersion(3);
	_format->setMinorVersion(3);
	_format->setProfile(QSurfaceFormat::OpenGLContextProfile::CompatibilityProfile);

	_GLContext->setFormat(*_format);
	_GLContext->create();


	if(_GLContext->isValid())
		std::cout << "_GLContext is valid." << std::endl;
	else
		std::cout << "_GLContext is not valid." << std::endl;

 
	if(_GLContext->makeCurrent(_window))
		std::cout << "Made current: _GLContext" << std::endl;
	else 
		std::cout << "Didn't make current: _GLContext" << std::endl;

	_window->openglContext()->format().setRenderableType(QSurfaceFormat::RenderableType::OpenGL);
	_window->openglContext()->format().setProfile(QSurfaceFormat::OpenGLContextProfile::CompatibilityProfile);
	_window->openglContext()->format().setMajorVersion(3);
	_window->openglContext()->format().setMinorVersion(3);
	std::cout << "GL info: " << glGetString(GL_VERSION) << std::endl;


	 //_GUIContext->makeCurrent(_window);
/*
  QSurfaceFormat f = _window->openglContext()->format();
  f.setVersion(3, 3);
  f.setProfile(QSurfaceFormat::CompatibilityProfile);
  _window->openglContext()->setFormat(f);
*/

	_GLFunctions = _window->openglContext()->functions();
	//GLuint hej;
	//_qlFunctions->glGenFramebuffers(1, &hej);


	t = 0;
	_program = new QOpenGLShaderProgram();
	_program->addShaderFromSourceCode(QOpenGLShader::Vertex, vertexShader);
	_program->addShaderFromSourceCode(QOpenGLShader::Fragment, fragmentShader);
		
	_program->bindAttributeLocation("vertices", 0);
		
	_program->link();

	connect(_window->openglContext(), SIGNAL(aboutToBeDestroyed()),
              this, SLOT(cleanup()), Qt::DirectConnection);




	createVolume(1,1,1,1);

	if(_window->openglContext()->isValid())
		std::cout << "_window->openglContext() is valid." << std::endl;
	else
		std::cout << "_window->openglContext() is not valid." << std::endl;




	// GLuint fboHandle;
 //    glGenFramebuffers(1, &fboHandle);
 //    glBindFramebuffer(GL_FRAMEBUFFER, fboHandle);
}
Exemplo n.º 6
0
void *Z_Malloc(size_t size, int tag, void *user)
{
    memblock_t *start, *iter;
    memvolume_t *volume;

    if (tag < PU_APPSTATIC || tag > PU_PURGELEVEL)
    {
        App_Log(DE2_LOG_WARNING, "Z_Malloc: Invalid purgelevel %i, cannot allocate memory.", tag);
        return NULL;
    }
    if (!size)
    {
        // You can't allocate "nothing."
        return NULL;
    }

    lockZone();

    // Align to pointer size.
    size = ALIGNED(size);

    // Account for size of block header.
    size += sizeof(memblock_t);

    // Iterate through memory volumes until we can find one with enough free
    // memory. (Note: we *will *find one that's large enough.)
    for (volume = volumeRoot; ; volume = volume->next)
    {
        uint numChecked = 0;
        dd_bool gotoNextVolume = false;

        if (volume == NULL)
        {
            // We've run out of volumes.  Let's allocate a new one
            // with enough memory.
            size_t newVolumeSize = MEMORY_VOLUME_SIZE;

            if (newVolumeSize < size + 0x1000)
                newVolumeSize = size + 0x1000; // with some spare memory

            volume = createVolume(newVolumeSize);
        }

        if (isVolumeTooFull(volume))
        {
            // We should skip this one.
            continue;
        }

        DENG_ASSERT(volume->zone);

        // Scan through the block list looking for the first free block of
        // sufficient size, throwing out any purgable blocks along the
        // way.

        if (tag == PU_APPSTATIC || tag == PU_GAMESTATIC)
        {
            // Appstatic allocations may be around for a long time so make sure
            // they don't litter the volume. Their own rover will keep them as
            // tightly packed as possible.
            iter = volume->zone->staticRover;
        }
        else
        {
            // Everything else is allocated using the rover.
            iter = volume->zone->rover;
        }
        assert(iter->prev);

        // Back up a little to see if we have some space available nearby.
        start = iter = rewindRover(volume, iter, 3, size);
        numChecked = 0;

        // If the start is in a sequence, move it to the beginning of the
        // entire sequence. Sequences are handled as a single unpurgable entity,
        // so we can stop checking at its start.
        if (start->seqFirst)
        {
            start = start->seqFirst;
        }

        // We will scan ahead until we find something big enough.
        for ( ; !(isFreeBlock(iter) && iter->size >= size); numChecked++)
        {
            // Check for purgable blocks we can dispose of.
            if (!isFreeBlock(iter))
            {
                if (iter->tag >= PU_PURGELEVEL)
                {
                    memblock_t *old = iter;
                    iter = iter->prev; // Step back.
#ifdef LIBDENG_FAKE_MEMORY_ZONE
                    freeBlock(old->area, &start);
#else
                    freeBlock((byte *) old + sizeof(memblock_t), &start);
#endif
                }
                else
                {
                    if (iter->seqFirst)
                    {
                        // This block is part of a sequence of blocks, none of
                        // which can be purged. Skip the entire sequence.
                        iter = iter->seqFirst->seqLast;
                    }
                }
            }

            // Move to the next block.
            iter = advanceBlock(volume, iter);

            // Ensure that iter will eventually touch start.
            assert(!start->seqFirst || start->seqFirst == start ||
                   !start->seqFirst->prev->seqFirst ||
                   start->seqFirst->prev->seqFirst == start->seqFirst->prev->seqLast);

            if (iter == start && numChecked > 0)
            {
                // Scanned all the way through, no suitable space found.
                gotoNextVolume = true;
                App_Log(DE2_LOG_DEBUG,
                        "Z_Malloc: gave up on volume after %i checks", numChecked);
                break;
            }
        }

        // At this point we've found/created a big enough block or we are
        // skipping this volume entirely.

        if (gotoNextVolume) continue;

        // Found a block big enough.
        if (iter->size - size > MINFRAGMENT)
        {
            splitFreeBlock(iter, size);
        }

#ifdef LIBDENG_FAKE_MEMORY_ZONE
        iter->areaSize = size - sizeof(memblock_t);
        iter->area = M_Malloc(iter->areaSize);
#endif

        if (user)
        {
            iter->user = user;      // mark as an in use block
#ifdef LIBDENG_FAKE_MEMORY_ZONE
            *(void **) user = iter->area;
#else
            *(void **) user = (void *) ((byte *) iter + sizeof(memblock_t));
#endif
        }
        else
        {
            // An owner is required for purgable blocks.
            DENG_ASSERT(tag < PU_PURGELEVEL);

            iter->user = MEMBLOCK_USER_ANONYMOUS; // mark as in use, but unowned
        }
        iter->tag = tag;

        if (tag == PU_MAPSTATIC)
        {
            // Level-statics are linked into unpurgable sequences so they can
            // be skipped en masse.
            iter->seqFirst = iter;
            iter->seqLast = iter;
            if (iter->prev->seqFirst)
            {
                iter->seqFirst = iter->prev->seqFirst;
                iter->seqFirst->seqLast = iter;
            }
        }
        else
        {
            // Not part of a sequence.
            iter->seqLast = iter->seqFirst = NULL;
        }

        // Next allocation will start looking here, at the rover.
        if (tag == PU_APPSTATIC || tag == PU_GAMESTATIC)
        {
            volume->zone->staticRover = advanceBlock(volume, iter);
        }
        else
        {
            volume->zone->rover = advanceBlock(volume, iter);
        }

        // Keep tabs on how much memory is used.
        volume->allocatedBytes += iter->size;

        iter->volume = volume;
        iter->id = LIBDENG_ZONEID;

        unlockZone();

#ifdef LIBDENG_FAKE_MEMORY_ZONE
        return iter->area;
#else
        return (void *) ((byte *) iter + sizeof(memblock_t));
#endif
    }
}
Exemplo n.º 7
0
int zuluCryptRunTest( void )
{	
	uid_t uid  = getuid() ;
	
	seteuid( 0 ) ;
	
	setgid( uid ) ;
	setgroups( 1,&uid ) ;
	setegid( uid ) ;
	setuid( uid ) ;
	
	if( _loop_device_module_is_not_present() ){
		printf( "\nWARNING: \"loop\" kernel module does not appear to be loaded\n" ) ;
		printf( "tests and opening of encrypted containers in files will fail if the module was not built into the kernel\n\n" ) ;
	}
	
	createTestImages() ;
	createKeyFiles() ;

	__printLine() ;
	createVolume( luksTestVolume,"create a luks type volume using a key: ","-p","luks" ) ;

	__printLine() ;
	checkIfDeviceIsLuks( luksTestVolume ) ;

	__printLine() ;
	createHeaderBackup( luksTestVolume,"create luks header backup: " ) ;
	
	__printLine() ;
	restoreHeaderBackup( luksTestVolume,"restore luks header from backup: " ) ;
	
	__printLine() ;
	createVolume( plainTestVolume,"create a plain type volume using a key: ","-p","plain" ) ;
	
	__printLine() ;
	openVolume( plainTestVolume,"open a plain volume with a key: ","-p" );
	closeVolume( plainTestVolume,"closing a plain volume: " ) ;
	
	__printLine() ;
	openVolume( plainTestVolume,"open a plain volume with a keyfile: ","-f" );
	closeVolume( plainTestVolume,"closing a plain volume: " ) ;
	
	__printLine() ;
	openVolumeWithPlugIn( plainTestVolume,"open a plain volume using a plugin: " ) ; 
	closeVolume( plainTestVolume,"closing a plain volume: " ) ;
	
	__printLine() ;
	openVolume( luksTestVolume,"open a luks volume with a key: ","-p" );
	closeVolume( luksTestVolume,"closing a luks volume: " ) ;
	
	__printLine() ;
	openVolume( luksTestVolume,"open a luks volume with a keyfile: ","-f" );
	closeVolume( luksTestVolume,"closing a luks volume: " ) ;
	
	__printLine() ;
	openVolumeWithPlugIn( luksTestVolume,"open a luks volume using a plugin: " ) ; 
	closeVolume( luksTestVolume,"closing a luks volume: " ) ;
	
	__printLine() ;
	checkKeySlotsInUse( luksTestVolume ) ;
	
	__printLine() ;
	addKeysToLuks( luksTestVolume ) ;
	
	__printLine() ;
	checkKeySlotsInUse( luksTestVolume ) ;
	
	__printLine() ;
	removeKeysFromLuksVolume( luksTestVolume ) ;
	checkKeySlotsInUse( luksTestVolume ) ;
	
	__printLine() ;
	checkForOpenedMappers() ;
	
	EXIT( 0,NULL ) ;
	return 0 ;
}