Пример #1
0
ccBox::ccBox(const CCVector3& dims, const ccGLMatrix* transMat/*= 0*/, QString name/*=QString("Box")*/)
	: ccGenericPrimitive(name,transMat)
	, m_dims(dims)
{
	buildUp();
	applyTransformationToVertices();
}
Пример #2
0
ccPlane::ccPlane(PointCoordinateType xWidth, PointCoordinateType yWidth, const ccGLMatrix* transMat/*=0*/, QString name/*=QString("Plane")*/)
	: ccGenericPrimitive(name,transMat)
	, m_xWidth(xWidth)
	, m_yWidth(yWidth)
{
	buildUp();
	applyTransformationToVertices();
}
    void GeometryRendererDemo::init() {
        AutoEvaluationPipeline::init();

        // load textureData from file
        cgt::TextureReaderTga trt;
        cgt::Texture* campTexture = trt.loadTexture(ShdrMgr.completePath("/modules/vis/sampledata/camplogo.tga"), cgt::Texture::LINEAR);
        ImageData* textureData = new ImageData(2, campTexture->getDimensions(), campTexture->getNumChannels());
        ImageRepresentationGL::create(textureData, campTexture);
        getDataContainer().addData("CampTexture", textureData);

        // connect slots
        _geometryReader.s_validated.connect(this, &GeometryRendererDemo::onProcessorValidated);

        // create Teapot
        auto teapot = GeometryDataFactory::createTeapot();
        teapot->applyTransformationToVertices(cgt::mat4::createTranslation(cgt::vec3(5.f, 10.f, 5.f)) * cgt::mat4::createScale(cgt::vec3(16.f)));
        getDataContainer().addData("teapot", teapot.release());

        // create cube
        auto cube = GeometryDataFactory::createCube(cgt::Bounds(cgt::vec3(7.f), cgt::vec3(9.f)), cgt::Bounds(cgt::vec3(0.f), cgt::vec3(1.f)));
        getDataContainer().addData("cube", cube.release());

        // setup pipeline
        _geometryReader.p_url.setValue(ShdrMgr.completePath("/modules/vis/sampledata/left_ventricle_mesh.vtk"));
        _geometryReader.p_targetImageID.setValue("reader.output");

        _lvRenderer.p_geometryID.setValue("reader.output");
        _lvRenderer.p_renderTargetID.setValue("lv.render");
        _lvRenderer.p_renderMode.selectById("triangles");
        _lvRenderer.p_solidColor.setValue(cgt::vec4(0.8f, 0.f, 0.f, .9f));

        _teapotRenderer.p_geometryID.setValue("teapot");
        _teapotRenderer.p_renderTargetID.setValue("teapot.render");
        _teapotRenderer.p_renderMode.selectById("trianglestrip");
        _teapotRenderer.p_showWireframe.setValue(false);
        _teapotRenderer.p_solidColor.setValue(cgt::vec4(1.f, 0.5f, 0.f, 1.f));
    
        _cubeRenderer.p_geometryID.setValue("cube");
        _cubeRenderer.p_renderTargetID.setValue("cube.render");
        _cubeRenderer.p_renderMode.selectById("trianglefan");
        _cubeRenderer.p_showWireframe.setValue(false);
        _cubeRenderer.p_textureID.setValue("CampTexture");
        _cubeRenderer.p_coloringMode.selectByOption(GeometryRenderer::TEXTURE_COLOR);

        _compositor1.p_firstImageId.setValue("lv.render");
        _compositor1.p_secondImageId.setValue("teapot.render");
        _compositor1.p_compositingMethod.selectById("depth");
        _compositor1.p_targetImageId.setValue("combine1");
        _compositor1.p_enableBackground.setValue(false);

        _compositor2.p_firstImageId.setValue("combine1");
        _compositor2.p_secondImageId.setValue("cube.render");
        _compositor2.p_compositingMethod.selectById("depth");
        _compositor2.p_targetImageId.setValue("combine2");

        _renderTargetID.setValue("combine2");
    }
Пример #4
0
bool ccGenericPrimitive::updateRepresentation()
{
	bool success = buildUp();
	if (success)
	{
		applyTransformationToVertices();
	}

	return success;
}
Пример #5
0
void ccCone::setTopRadius(PointCoordinateType radius)
{
	if (m_topRadius == radius)
		return;

	assert(radius > 0);
	m_topRadius = radius;
	
	buildUp();
	applyTransformationToVertices();
}
Пример #6
0
void ccCone::setHeight(PointCoordinateType height)
{
	if (m_height == height)
		return;

	assert(height > 0);
	m_height = height;
	
	buildUp();
	applyTransformationToVertices();
}
Пример #7
0
void ccBox::setDimensions(const CCVector3& dims)
{
    if (m_dims.x == dims.x && m_dims.y == dims.y && m_dims.z == dims.z)
    {
        return;
    }

    assert(dims.x > 0 && dims.y > 0 && dims.z > 0);
    m_dims = dims;

    buildUp();
    applyTransformationToVertices();
}
Пример #8
0
bool ccGenericPrimitive::setDrawingPrecision(unsigned steps)
{
	if (m_drawPrecision == steps)
		return true;
	if (steps < 4)
		return false;

	m_drawPrecision = steps;

	if (!buildUp())
		return false;

	applyTransformationToVertices();

	return true;
}