Ejemplo n.º 1
0
    //-----------------------------------------------------------------------
    PatchMeshPtr MeshManager::createBezierPatch(const String& name, const String& groupName, 
            void* controlPointBuffer, VertexDeclaration *declaration, 
            size_t width, size_t height,
            size_t uMaxSubdivisionLevel, size_t vMaxSubdivisionLevel,
            PatchSurface::VisibleSide visibleSide, 
            HardwareBuffer::Usage vbUsage, HardwareBuffer::Usage ibUsage,
            bool vbUseShadow, bool ibUseShadow)
    {
        if (width < 3 || height < 3)
        {
            OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS,
                "Bezier patch require at least 3x3 control points",
                "MeshManager::createBezierPatch");
        }

        MeshPtr pMesh = getByName(name);
        if (!pMesh.isNull())
        {
            OGRE_EXCEPT(Exception::ERR_DUPLICATE_ITEM, "A mesh called " + name + 
                " already exists!", "MeshManager::createBezierPatch");
        }
        PatchMesh* pm = OGRE_NEW PatchMesh(this, name, getNextHandle(), groupName);
        pm->define(controlPointBuffer, declaration, width, height,
            uMaxSubdivisionLevel, vMaxSubdivisionLevel, visibleSide, vbUsage, ibUsage,
            vbUseShadow, ibUseShadow);
        pm->load();
        ResourcePtr res(pm);
        addImpl(res);

        return res.staticCast<PatchMesh>();
    }
Ejemplo n.º 2
0
void CabbageEnvelopeHandleComponent::mouseDrag (const MouseEvent& e)
{
    CabbageEnvelopeHandleComponent* previousHandle = getPreviousHandle();
    CabbageEnvelopeHandleComponent* nextHandle = getNextHandle();
    bool fixed = this->getProperties().getWithDefault("fixedPos", false);


    int leftLimit = previousHandle == 0 ? 0 : previousHandle->getX()+1;
    int rightLimit = nextHandle == 0 ? getParentWidth()-previousHandle->getHeight() : nextHandle->getX()-1;
    int topLimit = previousHandle == 0 ? 0 : previousHandle->getX()+1;
    int bottomLimit = nextHandle == 0 ? getParentWidth()-previousHandle->getHeight() : nextHandle->getX()-1;
    int dragX = x+e.getDistanceFromDragStartX();
    int dragY = y+e.getDistanceFromDragStartY();

    //dragger.dragComponent(this, e, &resizeLimits);
    if(dragX < leftLimit)
        dragX = leftLimit;
    if(dragX > rightLimit)
        dragX = rightLimit;
    if(dragY< 0)
        dragY = 0;
    if(dragY > height-5)
        dragY = height-5;
    if(fixed)
        dragX = x;

    this->setTopLeftPosition(dragX, dragY);

    getParentComponent()->repaint();
}
void EnvelopeHandleComponent::mouseDown(const MouseEvent& e)
{
#ifdef MYDEBUG
	printf("MyEnvelopeHandleComponent::mouseDown (%d, %d)\n", e.x, e.y);
#endif
	
	setMouseCursor(MouseCursor::NoCursor);
	
	if(e.mods.isShiftDown()) {
		
        if(!shouldLockTime && !shouldLockValue)
        {
            getParentComponent()->setLegendTextToDefault();
            removeThisHandle();
		}
        
        return; // dont send drag msg
		
	} 
	else if(e.mods.isCtrlDown())
	{
		if(getParentComponent()->getAllowNodeEditing())
		{
			ignoreDrag = true;
			
			if(PopupComponent::getActivePopups() < 1)
			{
				EnvelopeNodePopup::create(this, getScreenX()+e.x, getScreenY()+e.y);
			}
		}
	}
	else 
	{
		
		offsetX = e.x;
		offsetY = e.y;
		
		resizeLimits.setMinimumOnscreenAmounts(HANDLESIZE,HANDLESIZE,HANDLESIZE,HANDLESIZE);
		
		EnvelopeHandleComponent* previousHandle = getPreviousHandle();
		EnvelopeHandleComponent* nextHandle = getNextHandle();
		
		int leftLimit = previousHandle == 0 ? 0 : previousHandle->getX()+2;
		int rightLimit = nextHandle == 0 ? getParentWidth()-HANDLESIZE : nextHandle->getX()-2;
//		int leftLimit = previousHandle == 0 ? 0 : previousHandle->getX();
//		int rightLimit = nextHandle == 0 ? getParentWidth()-HANDLESIZE : nextHandle->getX();

		
		resizeLimits.setAdjacentHandleLimits(leftLimit, rightLimit);

		dragger.startDraggingComponent(this, e);//&resizeLimits);
	
	}
    
    getParentComponent()->sendStartDrag();
}
Ejemplo n.º 4
0
    //---------------------------------------------------------------------------
    ResourcePtr GpuProgramManager::create(const String& name, const String& group, 
        GpuProgramType gptype, const String& syntaxCode, bool isManual, 
        ManualResourceLoader* loader)
    {
        // Call creation implementation
        ResourcePtr ret = ResourcePtr(
            createImpl(name, getNextHandle(), group, isManual, loader, gptype, syntaxCode));

        addImpl(ret);
        // Tell resource group manager
        ResourceGroupManager::getSingleton()._notifyResourceCreated(ret);
        return ret;
    }
Ejemplo n.º 5
0
static PayloadEntry* payld_allocate_entry(PldContext* context, CsrUint16 length)
{
    PayloadEntry* entry;
    require(TR_PAYLOAD_MGR, length != 0);

    sme_trace_entry((TR_PAYLOAD_MGR, "payld_allocate_entry() bytes %d payloadMax %d payloadCount %d", length, context->payloadMax, context->payloadCount));

    /* Check for Payload limit */
    if (context->payloadCount + 1 > context->payloadMax)
    {
#ifdef SME_TRACE_ENABLE
        pld_dump_owners(context);
#endif
        require(TR_PAYLOAD_MGR, context->payloadCount + 1 <= context->payloadMax);
        return NULL;
    }

    /* Create a list entry sized to the PayloadEntry + the buffer */
    entry = (PayloadEntry*)CsrPmalloc(sizeof(PayloadEntry) + length - 4 /* Size of the data array in PayloadEntry */); /*lint !e433 */
    entry->handle = getNextHandle(context);
    entry->size = length;

    verify(TR_PAYLOAD_MGR, payld_get_entry(context, PLDGET_HANDLE(entry->handle)) == NULL); /*lint !e666 */

    /* Insert at Head as the last 1 created is the most likely 1 to be accessed */
    csr_list_insert_head(&context->payloads, list_owns_value, &entry->node, entry);

    context->payloadCount++;

#ifdef SME_TRACE_ENABLE
    entry->records.recordsAdded = 0;
    entry->records.recordsCount = 0;

    /* Update payload manager statistics, output a diagnostic and return. */
    context->stats.totalAllocs++;
    context->stats.activeMemory += length;
    context->stats.currentPayloads++;
    if (context->stats.currentPayloads > context->stats.highPayloads)
    {
        context->stats.highPayloads = context->stats.currentPayloads;
    }
    if (context->stats.activeMemory > context->stats.highActiveMemory)
    {
        context->stats.highActiveMemory = context->stats.activeMemory;
    }
#endif

    return entry;
}
Ejemplo n.º 6
0
	//-----------------------------------------------------------------------
    ResourcePtr ResourceManager::create(const String& name, const String& group, 
		bool isManual, ManualResourceLoader* loader, const NameValuePairList* params)
	{
		// Call creation implementation
		ResourcePtr ret = ResourcePtr(
            createImpl(name, getNextHandle(), group, isManual, loader, params));
        if (params)
            ret->setParameterList(*params);

		addImpl(ret);
		// Tell resource group manager
		ResourceGroupManager::getSingleton()._notifyResourceCreated(ret);
		return ret;

	}
double EnvelopeHandleComponent::constrainDomain(double domainToConstrain) const
{ 
	EnvelopeHandleComponent* previousHandle = getPreviousHandle();
	EnvelopeHandleComponent* nextHandle = getNextHandle();

	int leftLimit = previousHandle == 0 ? 0 : previousHandle->getX();
	int rightLimit = nextHandle == 0 ? getParentWidth()-HANDLESIZE : nextHandle->getX();
	
	double left = getParentComponent()->convertPixelsToDomain(leftLimit);
	double right = getParentComponent()->convertPixelsToDomain(rightLimit);
	
	if(previousHandle != 0) left += FINETUNE;
	if(nextHandle != 0) right -= FINETUNE;
		
	return jlimit(left, right, shouldLockTime ? time : domainToConstrain);
}
    //---------------------------------------------------------------------------
    Resource* HighLevelGpuProgramManager::createImpl(const String& name, ResourceHandle handle, 
        const String& group, bool isManual, ManualResourceLoader* loader,
        const NameValuePairList* params)
    {
        NameValuePairList::const_iterator paramIt;

        if (!params || (paramIt = params->find("language")) == params->end())
        {
            OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS, 
                "You must supply a 'language' parameter",
                "HighLevelGpuProgramManager::createImpl");
        }

        return getFactory(paramIt->second)->create(this, name, getNextHandle(), 
            group, isManual, loader);
    }
    //---------------------------------------------------------------------------
    HighLevelGpuProgramPtr HighLevelGpuProgramManager::createProgram(
			const String& name, const String& groupName, 
            const String& language, GpuProgramType gptype)
    {
        ResourcePtr ret = ResourcePtr(
            getFactory(language)->create(this, name, getNextHandle(), 
            groupName, false, 0));

        HighLevelGpuProgramPtr prg = ret;
        prg->setType(gptype);
        prg->setSyntaxCode(language);

        addImpl(ret);
        // Tell resource group manager
        ResourceGroupManager::getSingleton()._notifyResourceCreated(ret);
        return prg;
    }
Ejemplo n.º 10
0
BOOL Csp::CPGetUserKey(
		IN  HCRYPTPROV hProv,
		IN  DWORD dwKeySpec,
		OUT HCRYPTKEY *phUserKey){
	DECL_RET(ret);
	try {
		CSPContext * it = *findContext(hProv);
		m_log << "GetUserKey, " << it->m_containerName << " dwKeySpec:" << dwKeySpec << std::endl;
		CSPKeyContext * key = it->createKeyContext();
		key->setPubkeySpec(dwKeySpec);
		key->m_keyId = getNextHandle();
		it->m_keys.push_back(key);
		*phUserKey = key->m_keyId;
		ret.SetOk();
	} catch(std::runtime_error &err) {
		ret.logReturn(err);
	}
	return ret;
}
Ejemplo n.º 11
0
Archivo: emul.c Proyecto: sfsy1989/j2me
KNIEXPORT KNI_RETURNTYPE_INT
Java_com_sun_midp_jsr82emul_ConnectionEmul_getHandle() {
    int protocol = (int)KNI_GetParameterAsInt(1);
    jint handle = (jint)getNextHandle(protocol);
    KNI_ReturnInt(handle);
}