Example #1
0
void CameraNode::updateCameraImage()
{
    if (!isAutoUpdateCameraImage()) {
        m_pCurBmp = m_pCamera->getImage(false);
        blt32(getTransform(), getSize(), getEffectiveOpacity(), getBlendMode());
    }
}
Example #2
0
void CameraNode::render()
{
    if (m_bIsPlaying) {
        ScopeTimer Timer(CameraProfilingZone);
        blt32(getTransform(), getSize(), getEffectiveOpacity(), getBlendMode());
    }
}
//-----------------------------------------------------------------------
void LayeredBlending::addPSBlendInvocations(Function* psMain, 
                                         ParameterPtr arg1,
                                         ParameterPtr arg2,
                                         ParameterPtr texel,
                                         int samplerIndex,
                                         const LayerBlendModeEx& blendMode,
                                         const int groupOrder, 
                                         int& internalCounter,
                                         int targetChannels)
{
    //
    // Add the modifier invocation
    //

    addPSModifierInvocation(psMain, samplerIndex, arg1, arg2, groupOrder, internalCounter, targetChannels);

    //
    // Add the blending function invocations
    //

    BlendMode mode = getBlendMode(samplerIndex);
    
    if ((LB_FFPBlend == mode) || (LB_Invalid == mode))
    {
        FFPTexturing::addPSBlendInvocations(psMain, arg1, arg2, texel, samplerIndex, blendMode, groupOrder, internalCounter, targetChannels);
    }
    else 
    {
        //find the function name for the blend mode
        String funcName;
        for(int i = 0 ; i < (int)LayeredBlending::LB_MaxBlendModes ; ++i)
        {
            if (_blendModes[i].type == mode)
            {
                funcName = _blendModes[i].funcName;
                break;
            }
        }

        //add the function of the blend mode
        if (funcName.empty() == false)
        {
            FunctionInvocation* curFuncInvocation = OGRE_NEW FunctionInvocation(funcName, groupOrder, internalCounter++);
            curFuncInvocation->pushOperand(arg1, Operand::OPS_IN, targetChannels);
            curFuncInvocation->pushOperand(arg2, Operand::OPS_IN, targetChannels);
            curFuncInvocation->pushOperand(mPSOutDiffuse, Operand::OPS_OUT, targetChannels);        
            psMain->addAtomInstance(curFuncInvocation); 
        }
    }
}
Example #4
0
	SPSurface Surface::resize(const spn::Size& s) const {
		auto bm = getBlendMode();
		auto* self = const_cast<Surface*>(this);
		self->setBlendMode(SDL_BLENDMODE_NONE);

		auto sz = getSize();
		spn::Rect srcRect(0,sz.width, 0,sz.height),
				dstRect(0,s.width, 0,s.height);
		SPSurface nsfc = Create(s.width, s.height, getFormat().format);
		blitScaled(nsfc, srcRect, dstRect);

		self->setBlendMode(bm);
		return nsfc;
	}
Example #5
0
    void Spider::draw(BITMAP *dest, int scrollx, int scrolly, unsigned int layer)
	{
		int l = mY + mH / 2 - mStartY;

		if (mHealth <= 0)
		{
			l = (l * mHurtTimer) / 25;
		}

		line(dest,
			 mX + mW / 2 - scrollx,
			 mY + mH / 2 - l - scrolly,
			 mX + mW / 2 - scrollx,
			 mY + mH / 2 - scrolly,
			 makecol(140, 140, 120));

		Animation::Blending blend = (mHurtTimer % 4 > 2) ? Animation::LIGHTEN : getBlendMode();
		mAnimation.drawFrame(dest, mY / 6, mX - scrollx - 2, mY - scrolly - 2, false, false, blend);
	}
    //---------------------------------------------------------------
    void EffectTextureExporter::exportTexture (
        COLLADASW::Texture* colladaTexture,
        String channelSemantic,
        const MObject& texture,
        int blendMode,
        const String& targetPath )
    {
        mAnimationTargetPath = targetPath;

        // Set the image name
        String colladaImageId = exportImage ( texture );
        colladaTexture->setImageId ( colladaImageId );
        colladaTexture->setTexcoord ( channelSemantic );

        // Get the current stream writer
        COLLADASW::StreamWriter* streamWriter = mDocumentExporter->getStreamWriter();

        // Create the sampler
        String samplerSid = colladaImageId + COLLADASW::Sampler::SAMPLER_SID_SUFFIX;
        String surfaceSid = colladaImageId + COLLADASW::Sampler::SURFACE_SID_SUFFIX;

        COLLADASW::Sampler sampler ( COLLADASW::Sampler::SAMPLER_TYPE_2D, samplerSid, surfaceSid );
        sampler.setFormat ( FORMAT );
        sampler.setImageId ( colladaImageId );

        colladaTexture->setSampler ( sampler );

        // Add 2D placement parameters
        add2DPlacement ( colladaTexture, texture );

        // Check for 3D projection node
        MObject colorReceiver = DagHelper::getSourceNodeConnectedTo ( texture, ATTR_OUT_COLOR );
        if ( colorReceiver != MObject::kNullObj && colorReceiver.apiType() == MFn::kProjection )
        {
            add3DProjection ( colladaTexture, colorReceiver );
        }

        // Add blend mode information
        String blendModeString = getBlendMode ( blendMode );
        colladaTexture->addExtraTechniqueParameter ( PROFILE_MAYA, MAYA_TEXTURE_BLENDMODE_PARAMETER, blendModeString );

        // Wrap elements
        switch ( colladaTexture->getSampler().getSamplerType() )
        {

        case COLLADASW::Sampler::SAMPLER_TYPE_1D:
            sampler.setWrapS ( COLLADASW::Sampler::WRAP_MODE_WRAP );
            break;

        case COLLADASW::Sampler::SAMPLER_TYPE_2D:
        {
            sampler.setWrapS ( COLLADASW::Sampler::WRAP_MODE_WRAP );
            sampler.setWrapT ( COLLADASW::Sampler::WRAP_MODE_WRAP );
        }
        break;

        case COLLADASW::Sampler::SAMPLER_TYPE_3D:
        case COLLADASW::Sampler::SAMPLER_TYPE_CUBE:
        {
            sampler.setWrapS ( COLLADASW::Sampler::WRAP_MODE_WRAP );
            sampler.setWrapT ( COLLADASW::Sampler::WRAP_MODE_WRAP );
            sampler.setWrapP ( COLLADASW::Sampler::WRAP_MODE_WRAP );
        }
        break;
        }

        sampler.setMinFilter ( COLLADASW::Sampler::SAMPLER_FILTER_NONE );
        sampler.setMagFilter ( COLLADASW::Sampler::SAMPLER_FILTER_NONE );
        sampler.setMipFilter ( COLLADASW::Sampler::SAMPLER_FILTER_NONE );
    }
Example #7
0
	int32_t LuaDrawable::getBlendMode(lua_State *L)
	{
		auto drawable = Lua::getObject<Drawable>(L, 1, LuaType::Drawable);
		Lua::pushEnum<BlendMode>(L, drawable->getBlendMode());
		return 1;
	}