void MaterialEditorDialog::OnComboStageStyle(wxCommandEvent &e)
{
	Ogre::String stageStyle = e.GetString().c_str();

	if (mCurrentFirstTexUnit)
	{
		if ( stageStyle == "Modulated" )
		{
			mCurrentFirstTexUnit->setColourOperationEx(Ogre::LBX_MODULATE);
		}
		else if ( stageStyle == "TransModulate2X" )
		{
			mCurrentFirstTexUnit->setColourOperationEx(Ogre::LBX_MODULATE_X2);
		}
		else if ( stageStyle == "TransModulate4X" )
		{
			mCurrentFirstTexUnit->setColourOperationEx(Ogre::LBX_MODULATE_X4);
		}	

		if ( gEffectSettingGlobalData.mCurrentParticleSystem &&
			gEffectSettingGlobalData.mCurrentParticleSystem->getRendererName() == "mesh" )
		{
			setMeshMaterial();
		}

	}
}
void MaterialEditorDialog::OnComboTexAddMode(wxCommandEvent &e)
{
	Ogre::String addMode = e.GetString().c_str();

	if (mCurrentFirstTexUnit)
	{
		if ( addMode == "Clamp" )
		{
			mCurrentFirstTexUnit->setTextureAddressingMode(Ogre::TextureUnitState::TAM_CLAMP);
		}
		else if ( addMode == "Wrap" )
		{
			mCurrentFirstTexUnit->setTextureAddressingMode(Ogre::TextureUnitState::TAM_WRAP);
		}
		else if ( addMode == "Mirror" )
		{
			mCurrentFirstTexUnit->setTextureAddressingMode(Ogre::TextureUnitState::TAM_MIRROR);
		}	

		if ( gEffectSettingGlobalData.mCurrentParticleSystem &&
			gEffectSettingGlobalData.mCurrentParticleSystem->getRendererName() == "mesh" )
		{
			setMeshMaterial();
		}

	}
}
示例#3
0
void SW::GLViewer::draw()
{
    // glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
    //m_shader.enable();
    //drawAxises(0.1, m_length);
    glPushAttrib( GL_ALL_ATTRIB_BITS );
    setMeshMaterial();
    foreach(SW::Mesh mesh, meshes){
        glPushMatrix();
          mesh.draw(displayType);
        glPopMatrix();
    }
void MaterialEditorDialog::OnTextCtrlRotateAnim(wxCommandEvent &e)
{
	if (mCurrentFirstTexUnit)
	{
		mCurrentFirstTexUnit->setRotateAnimation( Ogre::StringConverter::parseReal(mTexRotateAnimTextCtrl->GetValue().c_str()) );

		if ( gEffectSettingGlobalData.mCurrentParticleSystem &&
			gEffectSettingGlobalData.mCurrentParticleSystem->getRendererName() == "mesh" )
		{
			setMeshMaterial();
		}

	}
}
void MaterialEditorDialog::OnOpenButtonDown(wxCommandEvent &e)
{
	wxFileDialog dialog(this, _T("Choose a texture file"), EFFECT_PATH, wxT(""),
		"All texture files (*.dds;*.bmp;*.gif;*.png;*.jpg;*.tga)|*.dds;*.bmp;*.gif;*.png;*.jpg;*.tga", wxMULTIPLE); 

	if (dialog.ShowModal() == wxID_OK)
	{		
		mSelectedFileNames.clear();

		dialog.GetFilenames(mSelectedFileNames);

		if ( mSelectedFileNames.size() > 1 )
		{
			if (mCurrentFirstTexUnit)
			{
				Ogre::String firstTexName = mSelectedFileNames[0].c_str();

				Ogre::StringVector splitedName = Ogre::StringUtil::split( firstTexName, "_" );

				Ogre::StringVector splitedName1 = Ogre::StringUtil::split( splitedName[1], "." );

				mCurrentTexName = splitedName[0] + "." + splitedName1[1];

				mTexNameTextCtrl->SetValue(mCurrentTexName);

				float duration = Ogre::StringConverter::parseReal(mDurationTextCtrl->GetValue().c_str());

				mCurrentFirstTexUnit->setAnimatedTextureName(mCurrentTexName, mSelectedFileNames.size(), duration);
			}
		}
		else
		{
			if (mCurrentFirstTexUnit)
			{
				mCurrentTexName = mSelectedFileNames[0].c_str();
				mCurrentFirstTexUnit->setTextureName(mCurrentTexName);
				mTexNameTextCtrl->SetValue(mCurrentTexName);
			}
		}

		if ( gEffectSettingGlobalData.mCurrentParticleSystem &&
			gEffectSettingGlobalData.mCurrentParticleSystem->getRendererName() == "mesh" )
		{
			setMeshMaterial();
		}

	}
}
void MaterialEditorDialog::OnTextCtrlScale(wxCommandEvent &e)
{
	if (mCurrentFirstTexUnit)
	{
		Ogre::StringVector scales = Ogre::StringUtil::split(mTexScaleTextCtrl->GetValue().c_str());

		mCurrentFirstTexUnit->setTextureUScale( Ogre::StringConverter::parseReal(scales[0]) );
		mCurrentFirstTexUnit->setTextureVScale( Ogre::StringConverter::parseReal(scales[1]) );

		if ( gEffectSettingGlobalData.mCurrentParticleSystem &&
			gEffectSettingGlobalData.mCurrentParticleSystem->getRendererName() == "mesh" )
		{
			setMeshMaterial();
		}

	}
}
void MaterialEditorDialog::OnTextCtrlDuration(wxCommandEvent &e)
{
	if ( mSelectedFileNames.size() > 1 )
	{
		if (mCurrentFirstTexUnit)
		{
			float duration = Ogre::StringConverter::parseReal(mDurationTextCtrl->GetValue().c_str());

			mCurrentFirstTexUnit->setAnimatedTextureName(mCurrentTexName, mSelectedFileNames.size(), duration);
		}

		if ( gEffectSettingGlobalData.mCurrentParticleSystem &&
			gEffectSettingGlobalData.mCurrentParticleSystem->getRendererName() == "mesh" )
		{
			setMeshMaterial();
		}

	}
}
void MaterialEditorDialog::OnCheckBoxTwoSide(wxCommandEvent &e)
{
	if (mCurrentFirstPass)
	{
		if (e.IsChecked())
		{
			mCurrentFirstPass->setCullingMode(Ogre::CULL_NONE);
		}
		else
		{
			mCurrentFirstPass->setCullingMode(Ogre::CULL_CLOCKWISE);
		}

		if ( gEffectSettingGlobalData.mCurrentParticleSystem &&
			gEffectSettingGlobalData.mCurrentParticleSystem->getRendererName() == "mesh" )
		{
			setMeshMaterial();
		}

	}
}
void MaterialEditorDialog::OnComboDrawStyle(wxCommandEvent &e)
{
	Ogre::String drawStyle = e.GetString().c_str();

	if (mCurrentFirstPass)
	{
		if ( drawStyle == "Regular" )
		{
			mCurrentFirstPass->setSceneBlending(Ogre::SBF_ONE, Ogre::SBF_ZERO);
		}
		else if ( drawStyle == "Translucent" )
		{
			mCurrentFirstPass->setSceneBlending(Ogre::SBF_ONE, Ogre::SBF_ONE);
		}
		else if ( drawStyle == "Darken" )
		{
			mCurrentFirstPass->setSceneBlending(Ogre::SBF_ZERO, Ogre::SBF_ONE_MINUS_SOURCE_COLOUR);
		}
		else if ( drawStyle == "AlphaBlend" )
		{
			mCurrentFirstPass->setSceneBlending(Ogre::SBF_SOURCE_ALPHA, Ogre::SBF_ONE_MINUS_SOURCE_ALPHA);
		}
		else if ( drawStyle == "ColourBlend" )
		{
			mCurrentFirstPass->setSceneBlending(Ogre::SBF_SOURCE_COLOUR, Ogre::SBF_ONE_MINUS_SOURCE_COLOUR);

		}
		else if ( drawStyle == "Modulate" )
		{
			mCurrentFirstPass->setSceneBlending(Ogre::SBF_DEST_COLOUR, Ogre::SBF_ZERO);
		}

		if ( gEffectSettingGlobalData.mCurrentParticleSystem &&
			gEffectSettingGlobalData.mCurrentParticleSystem->getRendererName() == "mesh" )
		{
			setMeshMaterial();
		}
	}	
}