///creates new drawing here!
void DrawingWidget::trigger(MsbObject* other){

    if (other->name=="Draw Particles"){
        useTool=TOOL_DRAW;
        sceneData->drawTool->bPaintMesh=false;
        sceneData->brush->drawType=DRAW_SPRITE;
        setTextureID("icon_paint");
    }

    if (other->name=="Draw Calligraphy"){
        useTool=TOOL_CALLIGRAPHY;
        sceneData->drawTool->bPaintMesh=false;
        sceneData->brush->drawType=DRAW_SPRITE;
        setTextureID("icon_paintFancy");
    }

    if (other->name=="Draw Meshes"){
        useTool=TOOL_DRAW;
        sceneData->drawTool->bPaintMesh=true;
        sceneData->brush->drawType=DRAW_VBOMESH;
        setTextureID("icon_drawMesh");
    }


    //close widget and select again
    clickedRight();
    clickedLeft();

}
Esempio n. 2
0
	void Brick::damage()
	{
		health--;
		if (health == 1)
			setTextureID(1);
		else if (health == 2)
			setTextureID(6);
		//if(health < 0) this->destroy();
	}
void SelectWidget::trigger(MsbObject* other){

    if (other->name=="Select Objects"){
        useTool=TOOL_SELECT;
        setTextureID("icon_select");
    }

    if (other->name=="Select Particles"){
        useTool=TOOL_PARTICLESELECT;
        setTextureID("icon_selectParticles");
    }

    clickedRight();
    clickedLeft();

}
Esempio n. 4
0
void BoneWidget::trigger(MsbObject* other){

    if (other->name=="Paint Weights"){
        useTool=TOOL_SKIN;
        setTextureID("icon_paintWeights");
    }

    if (other->name=="Create Bone"){
        useTool=TOOL_BONE;
        setTextureID("icon_addBones");
    }

    clickedRight();
    clickedLeft();

}
void VideoTextureActor::setup(){


player=new ofVideoPlayer;
loadMovie("resources/"+videoInfo);
setTextureID(videoInfo);
player->setSpeed(playSpeed);     //44 to 48 kHz problem...
Actor::setup();
//player->setLoopState(OF_LOOP_NONE);
}
VideoTextureActor::VideoTextureActor(){

    videoInfo="video.xml";
    bPlaying = false;
    playSpeed=1.0f;
    sceneShaderID="texture";
    setTextureID("videoTexture");
    drawType = DRAW_PLANE;
    bTextured= true;
    registerProperties();

}
Esempio n. 7
0
void FileSystemActor::setTextureOverride( QString path )
{
	// set the override file path
	_overrideTexturePath = path;	
	if (!path.isEmpty())
	{
		loadThumbnailTexture(GLTextureObject(Load|Compress|Reload, _alternateThumbnailId, _overrideTexturePath, HiResImage, NormalPriority));

		if (!isThumbnailized())
			setTextureID(_alternateThumbnailId);
	}
}
Esempio n. 8
0
void fsPrim::init2(PrimMode prim_mode, bool is_share_data, PrimData* prim_data, u16 max_data_num, fsID scr_id, fsDraw* parent)
{
    if (m_rend)
    {
        m_rend->uninit();
    }

    m_private_flag.setOn(FLAG_INITIALIZED);

    setPrimMode(prim_mode);

    if (is_share_data)
    {
        if (!prim_data || max_data_num == 0)
        {
            fsThrow(ExceptionInvalidArgument);
        }

        if (m_prim_data && !m_is_share_data.getType())
        {
            fsDeleteArray(m_prim_data, PrimData);
        }

        m_is_share_data = true;
        m_prim_data = const_cast<PrimData*>(prim_data);
        m_max_data_num = max_data_num;
    }
    else
    {
        if (m_prim_data && m_is_share_data.getType())
        {
            m_prim_data = NULL;
            m_max_data_num = 0;
        }

        m_is_share_data = false;

        reallocData(max_data_num);
    }

    setCurDataNum(max_data_num);
    setTextureID(fsID::ZERO);

    if (parent)
    {
        setParent(parent);
    }
    else
    {
        setScreenID(scr_id);
    }
}
Esempio n. 9
0
GPUParticle::GPUParticle(unsigned int MAX) {
	//GPU Stuff
	uiMaxParticles = MAX;
	gpParticles = new GPUParticleS[ uiMaxParticles ];

	uivao[0] = 0;		uivao[1] = 0;
	uivbo[0] = 0;		uivbo[1] = 0;
	uiActiveBuffer = 0;	uiOtherBuffer = 0;
	createBuffers();
	createUpdateShader();
	createDrawShader();

	setTextureID(0);
}
Esempio n. 10
0
void StickyNoteActor::onRender(uint flags)
{
	if (!isActorType(Invisible))
	{
		if (_stickyNoteTextureId == 0)
			syncStickyNoteWithFileContents();
		
		setTextureID("icon.custom.stickyNote");
		Actor::onRender(flags);
#ifdef DXRENDER
		dxr->device->SetRenderState(D3DRS_ZENABLE, false);
		dxr->renderSideLessBox(getGlobalPosition(), getGlobalOrientation(), getDims(), _stickyNoteTextureId);
		dxr->device->SetRenderState(D3DRS_ZENABLE, true);
#endif
	}
}
Esempio n. 11
0
void TextureObject::draw(OpenglESProgram* openglESProgram, double sElapsed) {
	if (textureID == TextureManager::NO_TEXTURE) {
		setTextureID(TextureManager::getTextureID(picture));
	}

	doAnimation(sElapsed);

	glUseProgram(openglESProgram->getProgram());

	glVertexAttribPointer(openglESProgram->getVertexLocation(), POINT_DIMENSION, GL_FLOAT, GL_FALSE, STRIDE, attribute);
	glVertexAttribPointer(openglESProgram->getTextureCoordinatesLocation(), UV_DIMENSION, GL_FLOAT, GL_FALSE, STRIDE, attribute + POINT_DIMENSION);

	glEnableVertexAttribArray(openglESProgram->getVertexLocation());
	glEnableVertexAttribArray(openglESProgram->getTextureCoordinatesLocation());

	glUniform4fv(openglESProgram->getColorLocation(), 1, color);
	glUniform1f(openglESProgram->getAlphaLocation(), alpha);

	glUniform4fv(openglESProgram->getInVec4Location(), 1, inVec4);
	glUniform4fv(openglESProgram->getShowVec4Location(), 1, showVec4);

	glm::mat4 complexMatrix = transMatrix * rotateMatrix * scaleMatrix;
	glUniformMatrix4fv(openglESProgram->getChangeMatrixLocation(), 1, GL_FALSE, &complexMatrix[0][0]);

	glm::mat4 finalMatrix = openglESProgram->getmMVPMatrix() * complexMatrix;
	glUniformMatrix4fv(openglESProgram->getMatrixLocation(), 1, GL_FALSE, &finalMatrix[0][0]);

	glActiveTexture(GL_TEXTURE0);
	glBindTexture(GL_TEXTURE_2D, textureID);
	glUniform1f(openglESProgram->getTextureUnitLocation(), 0);

	glDrawArrays(GL_TRIANGLE_STRIP, 0, pointNum);

	glDisableVertexAttribArray(openglESProgram->getVertexLocation());
	glDisableVertexAttribArray(openglESProgram->getTextureCoordinatesLocation());
}
Esempio n. 12
0
void TextureObject::onSurfaceCreated() {
	setTextureID(TextureManager::NO_TEXTURE);
}
Esempio n. 13
0
void FileSystemActor::setFilePath(QString fullPath, bool skipTextureResolution /*=false*/)
{	
	if (_isAnimatedTexture)
		_animatedTextureSource.setPath(fullPath);

	// Save the Path (or Virtual Folder Name)
	filePath = fullPath;
	winOS->GetShortPathName(fullPath, shortPath);
	if (skipTextureResolution)
		return;

	// resolve the texture to load for this file if there is one
	QString ext = fsManager->getFileExtension(fullPath);
	QString texId;
	GLTextureDetail detail = FileIcon;
	GLTextureLoadPriority priority = NormalPriority;

	bool isVista = winOS->IsWindowsVersionGreaterThanOrEqualTo(WindowsVista);
	bool overrideSystemTextures = GLOBAL(settings).useThemeIconOverrides;
	int virtualIconId = winOS->GetIconTypeFromFileName(fullPath);
	if (virtualIconId > -1)
	{
		// mark this is a virtual icon
		pushFileSystemType(Virtual);
		pushFileSystemType(Folder);

		// check if we are overloading any virtual icons (only My Computer for now)
		if (overrideSystemTextures && 
			(virtualIconId == MyComputer) &&
			texMgr->hasTexture("override.virtual.mycomputer"))
		{
			texId = QT_NT("override.virtual.mycomputer");
			detail = HiResImage;
		}
		else
		{
			// otherwise, we will just load the icon later
			texId = fullPath;

			// NOTE: we force load these icons here because we do not do so if the 
			// texture id is set below
			loadThumbnailTexture(GLTextureObject(Load, texId, texId, FileIcon, priority, false));
		}
	}
	else
	{
		// not a virtual icon, just a random icon then
		unsigned int fileAttributes = fsManager->getFileAttributes(fullPath);

		// delete this object if it doesn't exist (and it's not a photo frame or volume)
		if (!fileAttributes &&
			!(isFileSystemType(PhotoFrame) || isFileSystemType(LogicalVolume)))
		{
			animManager->addAnimation(AnimationEntry(this, (FinishedCallBack) DeleteActorAfterAnim));
			setAlpha(0.0f);
			return;
		}

		// make sure there's no lingering animations
		animManager->removeAnimation(this);
		setAlpha(1.0f);

		// XXX: check if we are using animated textures
		// _isAnimatedTexture = (fileExtension == ".gif");

		// check if this is a shortcut
		// NOTE: if it is a valid shortcut, the file attributes and extension
		//		 now refer to the target and not the shortcut itself
		if (fileAttributes && ext == ".lnk")
		{
			// resolve the shortcut target
			fsManager->getShortcutTarget(fullPath, &lnkFullPath);
			if (fsManager->isValidFileName(lnkFullPath))
			{
				pushFileSystemType(Link);
				popFileSystemType(DeadLink);

				fileAttributes = fsManager->getFileAttributes(lnkFullPath);
				ext = fsManager->getFileExtension(lnkFullPath);
			}
			else
			{
				pushFileSystemType(DeadLink);
			}
		}


		// check if it is a folder
		if (fileAttributes & Directory)
		{
			pushFileSystemType(Folder);

			// XXX: only override shortcuts, and not folders?
			/*
			if (!overrideSystemTextures || !enableFileTypeIconsForShortcuts)
			{
				texId = winOS->GetSystemIconInfo(getFullPath());
			}
			else 
			*/
			if (overrideSystemTextures)
			{
				texId = QT_NT("override.ext.folder");
				detail = HiResImage;
			}		
		}
		else
		{
			// normal file
			pushFileSystemType(File);
			hasExtension(true); //only files have extension, so the nameable extension hide only applies here

			// resolve some information about the file
			if (ext.size() > 0)
			{
				if (ext == ".exe")
					pushFileSystemType(Executable);
				else
				{
					// XXX: check if it's a document
					// pushFileSystemType(Document);

					if (overrideSystemTextures)
					{
						QString potentialOverrideTex = QString(QT_NT("override.ext")) + ext;
						if (texMgr->hasTexture(potentialOverrideTex))
						{
							texId = potentialOverrideTex;
							detail = HiResImage;
						}
					}
				}

				// load the thumbnail if this is an image
				// NOTE: we append the period because if the extension is empty
				// the search is always true
				if (GLOBAL(supportedExtensions).contains(ext + "."))
				{
					if (!isThumbnailized())
						enableThumbnail(true, !winOS->IsFileInUse(fullPath));
					pushFileSystemType(Image);
					pushFileSystemType(Thumbnail);
					hideText(true);
				}
			}
		}
	}

	// at this point, resolve the file icon texture id if there was no override
	if (texId.isEmpty())
	{
		texId = winOS->GetSystemIconInfo(fullPath);

		// mark the texture for loading
		loadThumbnailTexture(GLTextureObject(Load, texId, texId, detail, priority,false));
	}
	setTextureID(texId);

	// we also want to try and load thumbnails for normal files if they exist
	// (as long as it's not a widget file)
	Widget * w = widgetManager->getActiveWidgetForFile(fullPath);
	if (!isThumbnailized() && (detail == FileIcon) && !w)
	{
		FileSystemActorType typesToIgnore = FileSystemActorType(Executable | Virtual);
		// on vista, just queue the thumbnail for loading
		if (isVista && !isFileSystemType(typesToIgnore))
		{
			QString ext = fsManager->getFileExtension(getTargetPath());
			loadThumbnailTexture(GLTextureObject(Load|Reload, _alternateThumbnailId, getTargetPath(), SampledImage, IdlePriority));
		}
		// on windows xp, check if the thumbs db has a record first
		else if (winOS->IsWindowsVersion(WindowsXP))
		{
			if (texMgr->hasWinThumbnail(getTargetPath()))
			{
				loadThumbnailTexture(GLTextureObject(Load|Reload, _alternateThumbnailId, getTargetPath(), SampledImage, IdlePriority));
			}
		}
	}

	// XXX: (disabled) set the initial dimensions and weight of this file based on it's size
	// setDimsFromFileSize(this);

	// set the text
	if(!isFileSystemType(PhotoFrame)) {
		if (w && w->isWidgetOverrideActor(this))
		{
			setText(w->getWidgetOverrideLabel(this));
			Vec3 actorDims = getDims();
			float aspect = (actorDims.x / actorDims.y);
			Vec3 dims(GLOBAL(settings).xDist, GLOBAL(settings).zDist / aspect, GLOBAL(settings).yDist);
			float scale = w->getWidgetOverrideScale(this);
			if (scale > 0.0f)
			{
				dims *= scale;
				setSizeAnim(getDims(), dims, 25);
			}
		}
		else
			setText(getFileName(isFileSystemType(Link) || isFileSystemType(DeadLink)));
	}
	setRespectIconExtensionVisibility(!isFileSystemType(Folder));


	// New name was set, invalidate text
	textManager->invalidate();
	rndrManager->invalidateRenderer();
}