Ejemplo n.º 1
0
void MusicTransformWidget::transformFinish(int)
{
    QSound::play("sound.wav");
    m_path.removeAt(0);
    ui->listWidget->clear();
    if(!m_path.isEmpty())
    {
        for(int i=0; i<m_path.count(); ++i)
        {
            ui->listWidget->addItem(QFontMetrics(font()).elidedText(m_path[i],
                                                                    Qt::ElideLeft, 215));
        }
        if(!processTransform(MAKE_TRANSFORM_AL))
        {
            return;
        }
    }
    else
    {
        setCheckedControl(true);
        ui->loadingLabel->hide();
        delete m_movie;
        m_movie = NULL;
    }
}
Ejemplo n.º 2
0
bool Parser::processTriangle()
{
	std::string strMaterial, strTemp;
	Point		p3P0,
				p3P1,
				p3P2;
	Material	*pMaterial;
	Shape		*pShape;
	Transform	tTrans;
	
	if(!readBloquePoint("vertex", p3P0))
		return false;
		
	if(!readBloquePoint("vertex", p3P1))
		return false;
		
	if(!readBloquePoint("vertex", p3P2))
		return false;
				
	if(!readBloqueTxt("material", strMaterial))
		return false;
	
	if(!ignorarChars())
		return false;
		
	if(!readToken(strTemp))
		return false;
	
	if(strTemp == "transform") {
		if(!processTransform(&tTrans))
			return false;
		
		if(!ignorarChars())
			return false;
		
		if(!readToken(strTemp))
			return false;
	}
	
	if(strTemp != "/object")
		return false;
	
	if((pMaterial = m_pGlobals->pScene->getMaterial(strMaterial)) != NULL) {
		pShape = new Triangle(p3P0, p3P1, p3P2, pMaterial);
		pShape->setTrans(&tTrans);
		m_pGlobals->pScene->addObject(pShape, strMaterial, pMaterial->isLight());		
	}
	else // Material asociado al objeto desconocido.
		return false; 
	
	return true;
}
Ejemplo n.º 3
0
bool Parser::processParallelogram()
{
	std::string strMaterial, strTemp;
	Point		p3Base;
	Vec3		v3VecU,
				v3VecV;
	Material	*pMaterial;
	Shape		*pShape;
	Transform	tTrans;
	
	if(!readBloquePoint("base", p3Base))
		return false;
		
	if(!readBloqueVec3("vec_u", v3VecU))
		return false;
		
	if(!readBloqueVec3("vec_v", v3VecV))
		return false;
				
	if(!readBloqueTxt("material", strMaterial))
		return false;
	
	if(!ignorarChars())
		return false;
		
	if(!readToken(strTemp))
		return false;
	
	if(strTemp == "transform") {
		if(!processTransform(&tTrans))
			return false;
		
		if(!ignorarChars())
			return false;
		
		if(!readToken(strTemp))
			return false;
	}
	
	if(strTemp != "/object")
		return false;
	
	if((pMaterial = m_pGlobals->pScene->getMaterial(strMaterial)) != NULL) {
		pShape = new Parallelogram(p3Base, v3VecU, v3VecV, pMaterial);
		pShape->setTrans(&tTrans);
		m_pGlobals->pScene->addObject(pShape, strMaterial, pMaterial->isLight());		
	}
	else // Material asociado al objeto desconocido.
		return false; 
	
	return true;
}
Ejemplo n.º 4
0
void MusicTransformWidget::startTransform()
{
    if(!QFile(MAKE_TRANSFORM_AL).exists() ||
       !processTransform(MAKE_TRANSFORM_AL))
    {
        return;
    }
    ///////////////////////////////////////////////////////////
    ui->loadingLabel->show();
    ui->loadingLabel->setMovie(m_movie = new QMovie(":/image/loading", QByteArray(), this));
    m_movie->start();
    setCheckedControl(false);
}
Ejemplo n.º 5
0
bool Parser::processCylinder()
{
	std::string strMaterial, strTemp;
	Point		p3P0, p3P1;
	float		dRadius;
	Material	*pMaterial;
	Shape		*pShape;
	Transform	tTrans;
	
	if(!readBloquePoint("center_0", p3P0))
		return false;
		
	if(!readBloquePoint("center_1", p3P1))
		return false;
		
	if(!readBloqueFloats("radius", 1, &dRadius))
		return false;
		
	if(!readBloqueTxt("material", strMaterial))
		return false;
	
	if(!ignorarChars())
		return false;
		
	if(!readToken(strTemp))
		return false;
	
	if(strTemp == "transform") {
		if(!processTransform(&tTrans))
			return false;
		
		if(!ignorarChars())
			return false;
		
		if(!readToken(strTemp))
			return false;
	}
	
	if(strTemp != "/object")
		return false;
	
	if((pMaterial = m_pGlobals->pScene->getMaterial(strMaterial)) != NULL) {
		pShape = new Cylinder(p3P0, p3P1, dRadius, pMaterial);
		pShape->setTrans(&tTrans);
		m_pGlobals->pScene->addObject(pShape, strMaterial, pMaterial->isLight());		
	}
	else // Material asociado al objeto desconocido.
		return false; 
	
	return true;
}
Ejemplo n.º 6
0
bool Parser::processPlane()
{
	std::string strMaterial, strTemp;
	Vec3		v3Normal;
	float		dDist;
	Material	*pMaterial;
	Shape		*pShape;
	Transform	tTrans;
		
	if(!readBloqueVec3("normal", v3Normal))
		return false;
		
	if(!readBloqueFloats("distance", 1, &dDist))
		return false;
		
	if(!readBloqueTxt("material", strMaterial))
		return false;
	
	if(!ignorarChars())
		return false;
		
	if(!readToken(strTemp))
		return false;
	
	if(strTemp == "transform") {
		if(!processTransform(&tTrans))
			return false;
		
		if(!ignorarChars())
			return false;
		
		if(!readToken(strTemp))
			return false;
	}
	
	if(strTemp != "/object")
		return false;
	
	if((pMaterial = m_pGlobals->pScene->getMaterial(strMaterial)) != NULL) {
		pShape = new Plane(v3Normal, dDist, pMaterial);
		pShape->setTrans(&tTrans);
		m_pGlobals->pScene->addObject(pShape, strMaterial, pMaterial->isLight());		
	}
	else // Material asociado al objeto desconocido.
		return false; 
	
	return true;
}
Ejemplo n.º 7
0
    bool PropertyWindow::processField(EditorComponentField& field) {
        ImGuiInputTextFlags flags = ImGuiInputTextFlags_EnterReturnsTrue | ImGuiInputTextFlags_CharsNoBlank;
        flags |= field._readOnly ? ImGuiInputTextFlags_ReadOnly : 0;

        bool ret = false;
        switch (field._type) {
            case EditorComponentFieldType::PUSH_TYPE: {
                ret = processBasicField(field);
            }break;
            case EditorComponentFieldType::BOUNDING_BOX: {
                BoundingBox bb = *static_cast<BoundingBox*>(field.data());
                F32* bbMin = Attorney::BoundingBoxEditor::min(bb);
                F32* bbMax = Attorney::BoundingBoxEditor::max(bb);
                ret = ImGui::InputFloat3("- Min ", bbMin, "%.3f", flags) ||
                      ImGui::InputFloat3("- Max ", bbMax, "%.3f", flags);
                if (ret) {
                    field.data(bb);
                }
            }break;
            case EditorComponentFieldType::BOUNDING_SPHERE: {
                BoundingSphere bs = *static_cast<BoundingSphere*>(field.data());
                F32* center = Attorney::BoundingSphereEditor::center(bs);
                F32& radius = Attorney::BoundingSphereEditor::radius(bs);
                ret = ImGui::InputFloat3("- Center ", center, "%.3f", flags) ||
                      ImGui::InputFloat("- Radius ", &radius, 0.0f, 0.0f, -1, flags);
                if (ret) {
                    field.data(bs);
                }
            }break;
            case EditorComponentFieldType::TRANSFORM: {
                assert(!field._dataSetter && "Need direct access to memory");
                ret = processTransform(static_cast<TransformComponent*>(field.data()), field._readOnly);
            }break;

            case EditorComponentFieldType::MATERIAL: {
                assert(!field._dataSetter && "Need direct access to memory");
                ret = processMaterial(static_cast<Material*>(field.data()), field._readOnly);
            }break;
        };

        return ret;
     }
Ejemplo n.º 8
0
bool Parser::processMesh()
{	
	std::string strMaterial, strTemp;
	Material	*pMaterial;
	Shape		*pShape;
	Transform	tTrans;
	
	// Lista de punteros a MeshTriangle a añadir a la escena, que será
	// construida durante la lectura de la lista de vértices o del
	// fichero .obj que se nos proporcione. Una vez construida, los
	// añadiremos a la escena.
	std::vector<MeshTriangle *> MTList;	
	
	if(!ignorarChars())
			return false;
			
	if(!readToken(strTemp))
		return false;
			
	if(strTemp == "vertex_list") {
		if(!processMeshVertex(pShape, &MTList))
			return false;
	}
	else if(strTemp == "file") {
		pShape = new Mesh();
		
		if(!processMeshFile(pShape, &MTList))
		return false;
	}
	else // Etiqueta desconocida, descripción errónea de la malla
		return false;
				
	if(!readBloqueTxt("material", strMaterial))
		return false;
	
	if(!ignorarChars())
		return false;
		
	if(!readToken(strTemp))
		return false;
	
	if(strTemp == "transform") {
		if(!processTransform(&tTrans))
			return false;
		
		if(!ignorarChars())
			return false;
		
		if(!readToken(strTemp))
			return false;
	}
	
	if(strTemp != "/object")
		return false;
	
	if((pMaterial = m_pGlobals->pScene->getMaterial(strMaterial)) != NULL) {
		pShape->setMaterial(pMaterial);
		pShape->setTrans(&tTrans);
		m_pGlobals->pScene->addObject(pShape, strMaterial, pMaterial->isLight());		
		
		// Añadimos ahora a la escena todos los triángulos que componen la malla
		for(int i = 0; i < (int) MTList.size(); i++)
			m_pGlobals->pScene->addObject((Shape *) MTList[i], strMaterial, pMaterial->isLight());		
	}
	else // Material asociado al objeto desconocido.
		return false; 
	
	return true;
}
Ejemplo n.º 9
0
	void ObjectRefInstance::process(real currentTime)
	{
		processKey(currentTime);
		processTransform();
	}