예제 #1
0
        private void setupModMenu()
        {
            MaterialPtr thumbMat = MaterialManager.Singleton.Create("ModThumbnail", "General");

            thumbMat.GetTechnique(0).GetPass(0).CreateTextureUnitState();
            MaterialPtr templateMat = MaterialManager.Singleton.GetByName("ModThumbnail");

            foreach (string itr in modThumb)
            {
                string name = "ModThumb" + (modThumbs.Count + 1).ToString();

                MaterialPtr newMat = templateMat.Clone(name);

                TextureUnitState tus = newMat.GetTechnique(0).GetPass(0).GetTextureUnitState(0);
                if (ResourceGroupManager.Singleton.ResourceExists("General", itr))
                {
                    tus.SetTextureName(itr);
                }
                else
                {
                    tus.SetTextureName("thumb_error.png");
                }

                BorderPanelOverlayElement bp = (BorderPanelOverlayElement)
                                               OverlayManager.Singleton.CreateOverlayElementFromTemplate("SdkTrays/Picture", "BorderPanel", (name));


                bp.HorizontalAlignment = (GuiHorizontalAlignment.GHA_RIGHT);
                bp.VerticalAlignment   = (GuiVerticalAlignment.GVA_CENTER);
                bp.MaterialName        = (name);
                GameManager.Instance.trayMgr.getTraysLayer().Add2D(bp);

                modThumbs.Add(bp);
            }
        }
예제 #2
0
        public void createScene()
        {
            Mogre.Vector3 vectLightPos = new Mogre.Vector3(75, 75, 75);
            m_pSceneMgr.CreateLight("Light").Position = vectLightPos;//(75, 75, 75);

            DotSceneLoader pDotSceneLoader = new DotSceneLoader();

            pDotSceneLoader.ParseDotScene("CubeScene.xml", "General", m_pSceneMgr, m_pSceneMgr.RootSceneNode);
            pDotSceneLoader = null;

            m_pSceneMgr.GetEntity("Cube01").QueryFlags = 1 << 1;
            m_pSceneMgr.GetEntity("Cube02").QueryFlags = 1 << 1; //(CUBE_MASK);
            m_pSceneMgr.GetEntity("Cube03").QueryFlags = 1 << 1; //(CUBE_MASK);

            m_pOgreHeadEntity            = m_pSceneMgr.CreateEntity("Cube", "ogrehead.mesh");
            m_pOgreHeadEntity.QueryFlags = 1 << 0;
            m_pOgreHeadNode = m_pSceneMgr.RootSceneNode.CreateChildSceneNode("CubeNode");
            m_pOgreHeadNode.AttachObject(m_pOgreHeadEntity);
            Mogre.Vector3 vectOgreHeadNodePos = new Mogre.Vector3(0, 0, -25);
            m_pOgreHeadNode.Position = vectOgreHeadNodePos;// (Vector3(0, 0, -25));

            m_pOgreHeadMat     = m_pOgreHeadEntity.GetSubEntity(1).GetMaterial();
            m_pOgreHeadMatHigh = m_pOgreHeadMat.Clone("OgreHeadMatHigh");
            ColourValue cvAmbinet = new Mogre.ColourValue(1, 0, 0);

            m_pOgreHeadMatHigh.GetTechnique(0).GetPass(0).Ambient = cvAmbinet;
            ColourValue cvDiffuse = new Mogre.ColourValue(1, 0, 0, 0);

            m_pOgreHeadMatHigh.GetTechnique(0).GetPass(0).Diffuse = cvDiffuse;

            physxScene.Simulate(0);
        }
예제 #3
0
        public static MaterialPtr CloneMaterial(String orgName, String cloneName)
        {
            if (MaterialManager.Singleton.ResourceExists(cloneName))
            {
                using (ResourcePtr res = MaterialManager.Singleton.GetByName(cloneName))
                    using (MaterialPtr matPtr = res)
                    {
                        if (matPtr.CompilationRequired)
                        {
                            matPtr.Compile();
                        }
                        return(matPtr);
                    }
            }


            using (ResourcePtr res = MaterialManager.Singleton.GetByName(orgName))
                using (MaterialPtr matPtr = res)
                {
                    if (matPtr.IsLoaded)
                    {
                        matPtr.Load();
                    }
                    if (matPtr.CompilationRequired)
                    {
                        matPtr.Compile();
                    }

                    return(matPtr.Clone(cloneName));
                }
        }
예제 #4
0
파일: Part.cs 프로젝트: ext0/Flex
        private void LoadMaterials(bool forceUpdate = false)
        {
            if (_baseMaterialPtr == null || forceUpdate)
            {
                _baseMaterialPtr = _material.GetMaterial().Clone(_UUID + "/DynamicMesh/" + Guid.NewGuid());
            }
            if (_frontMaterialPtr == null || forceUpdate)
            {
                _frontMaterialPtr = _baseMaterialPtr.Clone(_baseMaterialPtr.Name + "/Front");
            }
            if (_backMaterialPtr == null || forceUpdate)
            {
                _backMaterialPtr = _baseMaterialPtr.Clone(_baseMaterialPtr.Name + "/Back");
            }
            if (_leftMaterialPtr == null || forceUpdate)
            {
                _leftMaterialPtr = _baseMaterialPtr.Clone(_baseMaterialPtr.Name + "/Left");
            }
            if (_rightMaterialPtr == null || forceUpdate)
            {
                _rightMaterialPtr = _baseMaterialPtr.Clone(_baseMaterialPtr.Name + "/Right");
            }
            if (_topMaterialPtr == null || forceUpdate)
            {
                _topMaterialPtr = _baseMaterialPtr.Clone(_baseMaterialPtr.Name + "/Top");
            }
            if (_bottomMaterialPtr == null || forceUpdate)
            {
                _bottomMaterialPtr = _baseMaterialPtr.Clone(_baseMaterialPtr.Name + "/Bottom");
            }

            _textureScale = _material.TextureScaling();

            _frontMaterialPtr.SetAmbient(new ColourValue(_color.r / 255f, _color.g / 255f, _color.b / 255f, _color.transparency / 255f));
            //_frontMaterialPtr.SetDiffuse(_color.r / 255f, _color.g / 255f, _color.b / 255f, _color.transparency / 255f);
            //_frontMaterialPtr.SetSpecular(_color.r / 255f, _color.g / 255f, _color.b / 255f, _color.transparency / 255f);
            _frontMaterialPtr.GetTechnique(0).GetPass(0).GetTextureUnitState(0).SetTextureScale(_textureScale.x / size.x, _textureScale.y / size.y);

            _backMaterialPtr.SetAmbient(new ColourValue(_color.r / 255f, _color.g / 255f, _color.b / 255f, _color.transparency / 255f));
            //_backMaterialPtr.SetDiffuse(_color.r / 255f, _color.g / 255f, _color.b / 255f, _color.transparency / 255f);
            //_backMaterialPtr.SetSpecular(_color.r / 255f, _color.g / 255f, _color.b / 255f, _color.transparency / 255f);
            _backMaterialPtr.GetTechnique(0).GetPass(0).GetTextureUnitState(0).SetTextureScale(_textureScale.x / size.x, _textureScale.y / size.y);

            _leftMaterialPtr.SetAmbient(new ColourValue(_color.r / 255f, _color.g / 255f, _color.b / 255f, _color.transparency / 255f));
            //_leftMaterialPtr.SetDiffuse(_color.r / 255f, _color.g / 255f, _color.b / 255f, _color.transparency / 255f);
            //_leftMaterialPtr.SetSpecular(_color.r / 255f, _color.g / 255f, _color.b / 255f, _color.transparency / 255f);
            _leftMaterialPtr.GetTechnique(0).GetPass(0).GetTextureUnitState(0).SetTextureScale(_textureScale.x / size.y, _textureScale.y / size.z);

            _rightMaterialPtr.SetAmbient(new ColourValue(_color.r / 255f, _color.g / 255f, _color.b / 255f, _color.transparency / 255f));
            //_rightMaterialPtr.SetDiffuse(_color.r / 255f, _color.g / 255f, _color.b / 255f, _color.transparency / 255f);
            //_rightMaterialPtr.SetSpecular(_color.r / 255f, _color.g / 255f, _color.b / 255f, _color.transparency / 255f);
            _rightMaterialPtr.GetTechnique(0).GetPass(0).GetTextureUnitState(0).SetTextureScale(_textureScale.x / size.y, _textureScale.y / size.z);

            _topMaterialPtr.SetAmbient(new ColourValue(_color.r / 255f, _color.g / 255f, _color.b / 255f, _color.transparency / 255f));
            //_topMaterialPtr.SetDiffuse(_color.r / 255f, _color.g / 255f, _color.b / 255f, _color.transparency / 255f);
            //_topMaterialPtr.SetSpecular(_color.r / 255f, _color.g / 255f, _color.b / 255f, _color.transparency / 255f);
            _topMaterialPtr.GetTechnique(0).GetPass(0).GetTextureUnitState(0).SetTextureScale(_textureScale.x / size.x, _textureScale.y / size.z);

            _bottomMaterialPtr.SetAmbient(new ColourValue(_color.r / 255f, _color.g / 255f, _color.b / 255f, _color.transparency / 255f));
            //_bottomMaterialPtr.SetDiffuse(_color.r / 255f, _color.g / 255f, _color.b / 255f, _color.transparency / 255f);
            //_bottomMaterialPtr.SetSpecular(_color.r / 255f, _color.g / 255f, _color.b / 255f, _color.transparency / 255f);
            _bottomMaterialPtr.GetTechnique(0).GetPass(0).GetTextureUnitState(0).SetTextureScale(_textureScale.x / size.x, _textureScale.y / size.z);
        }