Пример #1
0
void LLUIImage::drawBorder(S32 x, S32 y, S32 width, S32 height, const LLColor4& color, S32 border_width) const
{
	LLRect border_rect;
	border_rect.setOriginAndSize(x, y, width, height);
	border_rect.stretch(border_width, border_width);
	drawSolid(border_rect, color);
}
bool EmulatedQemuCameraDevice::inWorkerThread()
{
    /* Wait till FPS timeout expires, or thread exit message is received. */
    WorkerThread::SelectRes res =
        getWorkerThread()->Select(-1, 1000000 / mEmulatedFPS);
    if (res == WorkerThread::EXIT_THREAD) {
        LOGV("%s: Worker thread has been terminated.", __FUNCTION__);
        return false;
    }

    /* Lets see if we need to generate a new frame. */
    if ((systemTime(SYSTEM_TIME_MONOTONIC) - mLastRedrawn) >= mRedrawAfter) {
        /*
         * Time to generate a new frame.
         */

#if EFCD_ROTATE_FRAME
        LOGV("%s: calld frame_type = rotateFrame():%d", __FUNCTION__, frame_type);
        const int frame_type = rotateFrame();
        switch (frame_type) {
            case 0:
                drawCheckerboard();
                break;
            case 1:
                drawStripes();
                break;
            case 2:
                drawSolid(mCurrentColor);
                break;
        }
#else
        /* Draw the checker board. */
        LOGV("%s: calld drawCheckerboard()", __FUNCTION__);
        drawCheckerboard();

#endif  // EFCD_ROTATE_FRAME

        mLastRedrawn = systemTime(SYSTEM_TIME_MONOTONIC);
    }

    /* Timestamp the current frame, and notify the camera HAL about new frame. */
    mCurFrameTimestamp = systemTime(SYSTEM_TIME_MONOTONIC);

    LOGV("%s: calld mCameraHAL->onNextFrameAvailable(mCurrentFrame:%p", __FUNCTION__,mCurrentFrame);
    mCameraHAL->onNextFrameAvailable(mCurrentFrame, mCurFrameTimestamp, this);

    return true;
}
Пример #3
0
void Lamp::update()
{ 
  // drawMenu(menuPosition());

  doLed();

  if (idleMetro.check()==1)
  {
    drawMenu(menuPosition());
    _idleTime++;
    if (_idleTime==10)  updateMenuIndex('t');
  }

  if (clkMetro.check()==1)	getDate();

  if (!_alarming)
  {
    switch (getDisplayMode())
    {
    case lAUDIO:
      drawAudio();
      break;
    case lCYCLE:
      drawCycle();
      break;
    case lRANDOM:
      drawRandom();
      break;
    case lSOLID:
      drawSolid();
      break;
    default:
      break;
    }
  }
  else
  {
    drawAlarm();
  }
}
Пример #4
0
void MeshPainter::drawMesh(Viewport3dSettings *viewportSettings, GSProductMesh *meshProduct, PaintLayer layer, bool background, int reflectionCount)
{
	MMesh *mesh = &( meshProduct->getMMeshForDisplay() );

	if ( mesh->getVertices().size() == 0 )
	{
		return;
	}

	ViewSettings *viewSettings = viewportSettings->getViewSettings();
	bool verticesFlag = viewportSettings->bForegroundVertices;
	bool cullFlag = viewSettings->bBackfaceCull;
	bool multilayerFlag = viewSettings->bMultilayer;
	bool markedfacesFlag = viewportSettings->bForegroundMarkedFaces;
	MeshLiveSubdWireframeMode liveSubdWireMode = background  ?  meshLiveSubdivisionWireframeMode  :  viewSettings->meshLiveSubdivisionWireframeMode;
	bool bLiveSubdivision = background  ?  bMeshLiveSubdivisionEnabled  :  viewSettings->bMeshLiveSubdivisionEnabled;
	bool bBackgroundTransparent = viewportSettings->bBackgroundTransparent;

	bool wireframeFlag, solidFlag, smoothFlag, texturedFlag;

	if ( background )
	{
		wireframeFlag = viewportSettings->bBackgroundWireframe;
		solidFlag = viewportSettings->bBackgroundSolid;
		smoothFlag = viewportSettings->bBackgroundSmooth;
		texturedFlag = viewportSettings->bBackgroundMaterial;
	}
	else
	{
		wireframeFlag = viewportSettings->bForegroundWireframe;
		solidFlag = viewportSettings->bForegroundSolid;
		smoothFlag = viewportSettings->bForegroundSmooth;
		texturedFlag = viewportSettings->bForegroundMaterial;
	}


	MMesh *subdMesh = NULL;

	if ( bLiveSubdivision )
	{
		int subdIterations = background  ?  meshLiveSubdivisionIterations  :  viewSettings->meshLiveSubdivisionIterations;
		int subdMaxFaces = background  ?  meshLiveSubdivisionMaxFaces  :  viewSettings->meshLiveSubdivisionMaxFaces;
		MPreserveNormalSharpness normalSharpness = background  ?  meshLiveSubdivisionNormalSharpness  :  viewSettings->meshLiveSubdivisionNormalSharpness;
		subdMesh = mesh->getLiveSubdivisionMesh( subdIterations, subdMaxFaces, normalSharpness );
	}

	if ( background  &&  bBackgroundTransparent )
	{
		if ( reflectionCount & 0x1 )
		{
			glCullFace( GL_FRONT );
		}
		else
		{
			glCullFace( GL_BACK );
		}
		glEnable( GL_CULL_FACE );


		if ( bLiveSubdivision )
		{
			if ( solidFlag   &&   ( layer == PAINTLAYER_OVERLAY_BLEND  ||  layer == PAINTLAYER_OVERLAY_BLEND_NODEPTH ) )
			{
				beginSolidRendering();
				drawSolidTransparent( subdMesh, smoothFlag );
				endSolidRendering();
			}
		}
		else
		{
			if ( solidFlag   &&   ( layer == PAINTLAYER_OVERLAY_BLEND  ||  layer == PAINTLAYER_OVERLAY_BLEND_NODEPTH ) )
			{
				beginSolidRendering();
				drawSolidTransparent( mesh, smoothFlag );
				endSolidRendering();
			}
		}

		if ( wireframeFlag )
		{
			if ( layer == PAINTLAYER_OVERLAY_BLEND  ||  layer == PAINTLAYER_OVERLAY_BLEND_NODEPTH )
			{
				drawWireframe( mesh, background, layer == PAINTLAYER_OVERLAY_BLEND_NODEPTH, reflectionCount != 0, true );
			}
		}

		glDisable( GL_CULL_FACE );
	}
	else
	{
		if ( cullFlag )
		{
			if ( reflectionCount & 0x1 )
			{
				glCullFace( GL_FRONT );
			}
			else
			{
				glCullFace( GL_BACK );
			}
			glEnable( GL_CULL_FACE );
		}


		if ( bLiveSubdivision )
		{
			if ( solidFlag  &&  layer == PAINTLAYER_OBJECTS )
			{
				beginSolidRendering();
				drawSolidUntextured( subdMesh, background, false, true, true );
				endSolidRendering();
			}
		}
		else
		{
			if ( solidFlag  &&  layer == PAINTLAYER_OBJECTS )
			{
				beginSolidRendering();
				drawSolid( viewportSettings, mesh, background, texturedFlag, reflectionCount != 0, smoothFlag );
				endSolidRendering();
			}
		}

		if ( bLiveSubdivision  &&  liveSubdWireMode != MESHLIVESUBDWIRE_NONE  &&  !background )
		{
			if ( layer == PAINTLAYER_WIREFRAME  ||  ( layer == PAINTLAYER_TRANSPARENCY  &&  multilayerFlag ) )
			{
				drawSubdividedWireframe( subdMesh, layer == PAINTLAYER_TRANSPARENCY, liveSubdWireMode );
			}
		}

		if ( wireframeFlag )
		{
			if ( layer == PAINTLAYER_WIREFRAME  ||  ( layer == PAINTLAYER_TRANSPARENCY  &&  multilayerFlag ) )
			{
				drawWireframe( mesh, background, layer == PAINTLAYER_TRANSPARENCY, reflectionCount != 0, false );
			}
		}

		if ( verticesFlag  &&  !background )
		{
			if ( layer == PAINTLAYER_WIREFRAME  ||  ( layer == PAINTLAYER_TRANSPARENCY  && multilayerFlag ) )
			{
				drawVertices( mesh, layer == PAINTLAYER_TRANSPARENCY, reflectionCount != 0 );
			}
		}

		if ( cullFlag )
		{
			glDisable( GL_CULL_FACE );
		}

		if ( markedfacesFlag  &&  layer == PAINTLAYER_OVERLAY_BLEND  &&  !background  &&  reflectionCount == 0 )
		{
			drawMarkedFacesPass( mesh );
		}
	}
}
Пример #5
0
void STKMeshSceneNode::render()
{
    irr::video::IVideoDriver* driver = irr_driver->getVideoDriver();

    if (!Mesh || !driver)
        return;

    bool isTransparentPass =
        SceneManager->getSceneNodeRenderPass() == scene::ESNRP_TRANSPARENT;

    ++PassCount;

    driver->setTransform(video::ETS_WORLD, AbsoluteTransformation);
    Box = Mesh->getBoundingBox();

    for (u32 i = 0; i<Mesh->getMeshBufferCount(); ++i)
    {
        scene::IMeshBuffer* mb = Mesh->getMeshBuffer(i);
        if (mb)
        {
            TextureMatrix = getMaterial(i).getTextureMatrix(0);
            const video::SMaterial& material = ReadOnlyMaterials ? mb->getMaterial() : Materials[i];

            video::IMaterialRenderer* rnd = driver->getMaterialRenderer(material.MaterialType);
            bool transparent = (rnd && rnd->isTransparent());

            if (isTransparentPass != transparent)
                continue;
            if (irr_driver->getPhase() == DISPLACEMENT_PASS)
            {
                initvaostate(GLmeshes[i], material.MaterialType);
                drawDisplace(GLmeshes[i]);
                continue;
            }
            if (!isObject(material.MaterialType))
            {
#ifdef DEBUG
                Log::warn("material", "Unhandled (static) material type : %d", material.MaterialType);
#endif
                continue;
            }

            // only render transparent buffer if this is the transparent render pass
            // and solid only in solid pass
            if (irr_driver->getPhase() == GLOW_PASS)
            {
                initvaostate(GLmeshes[i], material.MaterialType);
                drawGlow(GLmeshes[i]);
            }
            else if (irr_driver->getPhase() == SHADOW_PASS)
            {
                initvaostate(GLmeshes[i], material.MaterialType);
                drawShadow(GLmeshes[i], material.MaterialType);
            }
            else
            {
                irr_driver->IncreaseObjectCount();
                initvaostate(GLmeshes[i], material.MaterialType);
                if (transparent)
                    drawTransparent(GLmeshes[i], material.MaterialType);
                else
                    drawSolid(GLmeshes[i], material.MaterialType);
            }
        }
    }
}