Exemplo n.º 1
0
void AudioScope::render(int width, int height) {
    
    if (!_isEnabled) {
        return;
    }
    
    static const float backgroundColor[4] = { 0.4f, 0.4f, 0.4f, 0.6f };
    static const float gridColor[4] = { 0.7f, 0.7f, 0.7f, 1.0f };
    static const float inputColor[4] = { 0.3f, 1.0f, 0.3f, 1.0f };
    static const float outputLeftColor[4] = { 1.0f, 0.3f, 0.3f, 1.0f };
    static const float outputRightColor[4] = { 0.3f, 0.3f, 1.0f, 1.0f };
    static const int gridRows = 2;
    int gridCols = _framesPerScope;
    
    int x = (width - (int)SCOPE_WIDTH) / 2;
    int y = (height - (int)SCOPE_HEIGHT) / 2;
    int w = (int)SCOPE_WIDTH;
    int h = (int)SCOPE_HEIGHT;
    
    renderBackground(backgroundColor, x, y, w, h);
    renderGrid(gridColor, x, y, w, h, gridRows, gridCols);
    
    renderLineStrip(_inputID, inputColor, x, y, _samplesPerScope, _scopeInputOffset, _scopeInput);
    renderLineStrip(_outputLeftID, outputLeftColor, x, y, _samplesPerScope, _scopeOutputOffset, _scopeOutputLeft);
    renderLineStrip(_outputRightD, outputRightColor, x, y, _samplesPerScope, _scopeOutputOffset, _scopeOutputRight);
}
Exemplo n.º 2
0
void AudioScope::render(RenderArgs* renderArgs, int width, int height) {
    
    if (!_isEnabled) {
        return;
    }
    
    static const glm::vec4 backgroundColor = { 0.4f, 0.4f, 0.4f, 0.6f };
    static const glm::vec4 gridColor = { 0.7f, 0.7f, 0.7f, 1.0f };
    static const glm::vec4 inputColor = { 0.3f, 1.0f, 0.3f, 1.0f };
    static const glm::vec4 outputLeftColor = { 1.0f, 0.3f, 0.3f, 1.0f };
    static const glm::vec4 outputRightColor = { 0.3f, 0.3f, 1.0f, 1.0f };
    static const int gridRows = 2;
    int gridCols = _framesPerScope;
    
    int x = (width - (int)SCOPE_WIDTH) / 2;
    int y = (height - (int)SCOPE_HEIGHT) / 2;
    int w = (int)SCOPE_WIDTH;
    int h = (int)SCOPE_HEIGHT;

    gpu::Batch& batch = *renderArgs->_batch;
    auto geometryCache = DependencyManager::get<GeometryCache>();
    geometryCache->useSimpleDrawPipeline(batch);
    auto textureCache = DependencyManager::get<TextureCache>();
    batch.setResourceTexture(0, textureCache->getWhiteTexture());
    
    // FIXME - do we really need to reset this here? we know that we're called inside of ApplicationOverlay::renderOverlays
    //         which already set up our batch for us to have these settings
    mat4 legacyProjection = glm::ortho<float>(0, width, height, 0, -1000, 1000);
    batch.setProjectionTransform(legacyProjection);
    batch.setModelTransform(Transform());
    batch.setViewTransform(Transform());

    geometryCache->renderQuad(batch, x, y, w, h, backgroundColor, _audioScopeBackground);
    geometryCache->renderGrid(batch, x, y, w, h, gridRows, gridCols, gridColor, _audioScopeGrid);
    renderLineStrip(batch, _inputID, inputColor, x, y, _samplesPerScope, _scopeInputOffset, _scopeInput);
    renderLineStrip(batch, _outputLeftID, outputLeftColor, x, y, _samplesPerScope, _scopeOutputOffset, _scopeOutputLeft);
    renderLineStrip(batch, _outputRightD, outputRightColor, x, y, _samplesPerScope, _scopeOutputOffset, _scopeOutputRight);
}
Exemplo n.º 3
0
void AudioScope::render(RenderArgs* renderArgs, int width, int height) {
    
    if (!_isEnabled) {
        return;
    }
    
    static const glm::vec4 backgroundColor = { 0.4f, 0.4f, 0.4f, 0.6f };
    static const glm::vec4 gridColor = { 0.7f, 0.7f, 0.7f, 1.0f };
    static const glm::vec4 inputColor = { 0.3f, 1.0f, 0.3f, 1.0f };
    static const glm::vec4 outputLeftColor = { 1.0f, 0.3f, 0.3f, 1.0f };
    static const glm::vec4 outputRightColor = { 0.3f, 0.3f, 1.0f, 1.0f };
    static const int gridRows = 2;
    int gridCols = _framesPerScope;
    
    int x = (width - (int)SCOPE_WIDTH) / 2;
    int y = (height - (int)SCOPE_HEIGHT) / 2;
    int w = (int)SCOPE_WIDTH;
    int h = (int)SCOPE_HEIGHT;

    gpu::Batch batch;
    auto geometryCache = DependencyManager::get<GeometryCache>();
    geometryCache->useSimpleDrawPipeline(batch);
    auto textureCache = DependencyManager::get<TextureCache>();
    batch.setResourceTexture(0, textureCache->getWhiteTexture());
    mat4 legacyProjection = glm::ortho<float>(0, width, height, 0, -1000, 1000);
    batch.setProjectionTransform(legacyProjection);
    batch.setModelTransform(Transform());
    batch.setViewTransform(Transform());
    geometryCache->renderQuad(batch, x, y, w, h, backgroundColor);
    geometryCache->renderGrid(batch, x, y, w, h, gridRows, gridCols, gridColor, _audioScopeGrid);
    renderLineStrip(batch, _inputID, inputColor, x, y, _samplesPerScope, _scopeInputOffset, _scopeInput);
    renderLineStrip(batch, _outputLeftID, outputLeftColor, x, y, _samplesPerScope, _scopeOutputOffset, _scopeOutputLeft);
    renderLineStrip(batch, _outputRightD, outputRightColor, x, y, _samplesPerScope, _scopeOutputOffset, _scopeOutputRight);
    renderArgs->_context->syncCache();
    renderArgs->_context->render(batch);
}
Exemplo n.º 4
0
	void cBatchRenderManager::renderLine()
	{
		_getRenderPropertyMgr()->begin();
		_getRenderPropertyMgr()->setProperty(sRenderProperty::LIGHTING, FALSE);

		LPDIRECT3DDEVICE9 device = cD3DSystem::getD3DDevice();
		device->SetTexture(0, NULL);
		device->SetVertexShader(NULL);
		device->SetPixelShader(NULL);
		device->SetFVF(sLineVertex::D3DFVF);

		renderLineList();
		renderLineStrip();

		_getRenderPropertyMgr()->end();
	}