public override void enter(ModData e = null) { m_bQuit = false; sceneMgr = GameManager.Instance.root.CreateSceneManager(SceneType.ST_GENERIC, "PauseSceneMgr"); ColourValue cvAmbineLight = new ColourValue(0.7f, 0.7f, 0.7f); sceneMgr.AmbientLight = cvAmbineLight; camera = sceneMgr.CreateCamera("PauseCam"); camera.Position = new Mogre.Vector3(0, 0, 0); camera.NearClipDistance = 1; camera.AspectRatio = GameManager.Instance.viewport.ActualWidth / GameManager.Instance.viewport.ActualHeight; GameManager.Instance.viewport.Camera = camera; UIManager.Instance.DestroyAllWidgets(); UIManager.Instance.ShowCursor(); UIManager.Instance.CreateButton(UIWidgetLocation.TL_CENTER, "BackToMenuBtn", LocateSystem.Instance.LOC(LocateFileType.GameQuickString, "Back To Game"), 250); UIManager.Instance.CreateButton(UIWidgetLocation.TL_CENTER, "ExitBtn", LocateSystem.Instance.LOC(LocateFileType.GameQuickString, "Quit"), 250); UIManager.Instance.CreateLabel(UIWidgetLocation.TL_TOP, "PauseLbl", LocateSystem.Instance.LOC(LocateFileType.GameQuickString, "Game Paused"), 250); GameManager.Instance.mouse.MouseMoved += new MouseListener.MouseMovedHandler(mouseMoved); GameManager.Instance.mouse.MousePressed += new MouseListener.MousePressedHandler(mousePressed); GameManager.Instance.mouse.MouseReleased += new MouseListener.MouseReleasedHandler(mouseReleased); m_bQuestionActive = true; createScene(); }
public static void AddTextBox(String id, String text, float x, float y, float width, float height, ColourValue colorTop, ColourValue colorBot) { try { OverlayManager overlayMgr = OverlayManager.Singleton; OverlayContainer panel = (OverlayContainer)overlayMgr.CreateOverlayElement("Panel", "_panel_" + id); panel.MetricsMode = GuiMetricsMode.GMM_PIXELS; panel.SetPosition(x, y); panel.SetDimensions(width, height); TextAreaOverlayElement textArea = (TextAreaOverlayElement)overlayMgr.CreateOverlayElement("TextArea", "_area_" + id); textArea.MetricsMode = GuiMetricsMode.GMM_PIXELS; textArea.SetPosition(0, 0); textArea.SetDimensions(width, height); textArea.Caption = text; textArea.CharHeight = 16; textArea.FontName = "Verdana"; textArea.ColourTop = colorTop; textArea.ColourBottom = colorBot; Overlay overlay = overlayMgr.Create("_overlay_" + id); overlay.Add2D(panel); panel.AddChild(textArea); overlay.Show(); } catch (Exception e) { Util.Log("Unable to create text area."); } }
public int AddTriangleVertex(Vector3 vertex, ColourValue colour) { triangleVertices.AddLast(new KeyValuePair <Vector3, ColourValue>(vertex, colour)); trianglesIndex += 1; return(trianglesIndex - 1); }
public int AddLineVertex(Vector3 vertex, ColourValue colour) { lineVertices.AddLast(new KeyValuePair <Vector3, ColourValue>(vertex, colour)); linesIndex += 1; return(linesIndex - 1); }
/// <summary> /// Sets distance fog in the game /// </summary> private void SetFog() { ColourValue fadeColour = new ColourValue(0.9f, 0.9f, 1f); mSceneMgr.SetFog(FogMode.FOG_EXP2, fadeColour, 0.0015f); mWindow.GetViewport(0).BackgroundColour = fadeColour; }
private void UpdateCloudPoints(List <Point3D> PointsList, Decimal d_threshold_meters) { if (manual == null) { return; } if (PointsList == null) { return; } double threshold = (double)d_threshold_meters * 1000d; // convert to mm try { manual.Begin("BaseWhiteNoLighting", RenderOperation.OperationTypes.OT_POINT_LIST); // Real data foreach (Point3D sp in PointsList) { ColourValue cv = sp.color; Vector3 v = new Vector3((float)sp.x, (float)sp.y, (float)sp.z); manual.Position(v); manual.Colour(cv); } manual.End(); } catch (Exception e) { MessageBox.Show("Exception when plotting points: " + e.Message); // ignore throw e; } }
public override void enter(ModData e = null) { modData = e; sceneMgr = GameManager.Instance.root.CreateSceneManager(Mogre.SceneType.ST_GENERIC, "LoadingSceneMgr"); ColourValue cvAmbineLight = new ColourValue(0.7f, 0.7f, 0.7f); sceneMgr.AmbientLight = cvAmbineLight; camera = sceneMgr.CreateCamera("LoadingScreenCam"); camera.SetPosition(0, 25, -50); Vector3 vectorCameraLookat = new Mogre.Vector3(0, 0, 0); camera.LookAt(vectorCameraLookat); camera.NearClipDistance = 1; camera.AspectRatio = GameManager.Instance.viewport.ActualWidth / GameManager.Instance.viewport.ActualHeight; GameManager.Instance.viewport.Camera = camera; GameManager.Instance.trayMgr.destroyAllWidgets(); progressBar = GameManager.Instance.trayMgr.createProgressBar(TrayLocation.TL_CENTER, "pbProcessBar", "Loading", 500, 300); progressBar.setComment(GameManager.Instance.loadingData.Comment); switch (GameManager.Instance.loadingData.Type) { case LoadingType.LOADING_MOD: ModManager.Instance.LoadingModProcessing += LoadingModProcessing; ModManager.Instance.LoadingModFinished += LoadingModFinished; ModManager.Instance.LoadMod(GameManager.Instance.loadingData.LoadingObjName); break; } }
public LightWibbler(Light light, Billboard billboard, Color minColour, Color maxColour, float minSize, float maxSize) : base() { mCVFH = new ControllerValueFloatDirector(); mCVFH.SubscribeEvents(); mCVFH.GetValueFunction += new CVFHGetValueDelegate(GetValue); mCVFH.SetValueFunction += new CVFHSetValueDelegate(SetValue); mLight = light; mBillboard = billboard; mColourRange = new OgreDotNet.ColourValue(); mHalfColour = new OgreDotNet.ColourValue(); mColourRange.r = ((maxColour.R - minColour.R) / 255.0f) * 0.5f; mColourRange.g = ((maxColour.G - minColour.G) / 255.0f) * 0.5f; mColourRange.b = ((maxColour.B - minColour.B) / 255.0f) * 0.5f; mHalfColour.r = Converter.ToColourValue(minColour).r + mColourRange.r; mHalfColour.g = Converter.ToColourValue(minColour).g + mColourRange.g; mHalfColour.b = Converter.ToColourValue(minColour).b + mColourRange.b; mMinSize = minSize; mSizeRange = maxSize - minSize; intensity = 1; }
public static System.Drawing.Color ToColor(ColourValue c) { return(Color.FromArgb((int)(c.a * 255.0f), (int)(c.r * 255.0f), (int)(c.g * 255.0f), (int)(c.b * 255.0f))); }
public override void Restore() { // animationState = installationEntity.GetAnimationState("manual"); // animationState.Enabled = true; // animationState.Loop = false; if (reflectorNode != null) { flickeringReflectorWhenDestroyed = UnitConverter.RandomGen.Next(0, 2) == 0; reflectorNode.SetVisible(true); } if (isConcrete) { ViewHelper.ReplaceMaterial(installationEntity, "DestroyedConcrete", "Concrete"); } else { ViewHelper.ReplaceMaterial(installationEntity, "DestroyedWood", "Wood"); } EffectsManager.Singleton.NoSmoke(sceneMgr, installationNode); EffectsManager.Singleton.HideSprite(sceneMgr, installationNode, EffectsManager.EffectType.FIRE, 0); if (EngineConfig.DisplayingMinimap) { ColourValue col = ColourValue.Red; if (isConcrete) { col = new ColourValue(0, 0, 1); } minimapItem.Colour = col; minimapItem.Refresh(); } }
void CreateJoystickPointerControl(Window parentWindow, float y, int axisNo) { ColourValue cv; string windowMaterial = "bgui.window"; if (axisNo == KeyMap.Instance.JoystickHorizontalAxisNo || axisNo == KeyMap.Instance.JoystickVerticalAxisNo) { cv = new ColourValue(1.0f, 0.8f, 0.0f); windowMaterial = "bgui.window.yellow"; } else { cv = ColourValue.White; } float pointerWindowSize = parentWindow.w * 0.4f; int yshift = (int)(joystickWindows.Count * (0.85f * GetTextVSpacing())); var pos = new Vector4(parentWindow.x + 0.5f * (parentWindow.w - pointerWindowSize), parentWindow.y + y + GetTextVSpacing() + yshift, pointerWindowSize, 0.75f * GetTextVSpacing()); joystickWindows.Add(mGui.createWindow(pos, windowMaterial, (int)wt.NONE, "")); int index = joystickWindows.Count - 1; pos.x = GetTextVSpacing(); // left pos.y -= parentWindow.y; pos.w = GetTextVSpacing(); // height parentWindow.createStaticText(pos, LanguageResources.GetString(LanguageKey.JoystickAxis) + " " + axisNo, cv); joystickPointerAxis.Add(axisNo); joystickPointers.Add(mGui.createWindow(getJoystickPointerRect(joystickWindows[index], axisNo), "bgui.window.pointer", (int)wt.NONE, "")); }
public override void CreateScene() { ColourValue fadeColour = new ColourValue(0.9f, 0.9f, 0.9f); base.sceneMgr.SetFog(FogMode.FOG_LINEAR, fadeColour, 0, 100, 900); //base.sceneMgr.SetFog(FogMode.FOG_EXP, fadeColour, 0.009f); base.viewport.BackgroundColour = fadeColour; Plane plane; plane.d = 100; plane.normal = Vector3.NEGATIVE_UNIT_Y; base.sceneMgr.SetWorldGeometry("terrain.cfg"); base.sceneMgr.SetSkyPlane(true, plane, "Examples/CloudySky", 500, 20, true, 0.5f, 150, 150); //FSLSoundObject backgroundSound = soundManager.CreateAmbientSound("../../media/sound/windy1.ogg", "Ambiente1", true); //Create Ambient sound //backgroundSound.Play(); //BoidMesh.CreateBoidMesh("myBoid_green", "green"); //BoidMesh.CreateBoidMesh("myBoid_red", "red"); boidNodesList = new List <SceneNode>(); for (int i = 0; i < boidsManager.KnownBoidsList.Count; i++) { AddNewBoid(boidsManager.KnownBoidsList[i]); } boidsManager.OnNewBoid += new AddNewBoid(AddNewBoid); }
public void Create() { // create the solid object this.solidObject = Engine.Graphics.SceneManager.CreateManualObject(); this.solidObject.VisibilityFlags = ViewportController.VF_PERSPECTIVE; this.solidObject.UserObject = this; DrawSolid(false); // create the wireframe version float r = Mogre.Math.RangeRandom(0.5f, 1.0f); float g = Mogre.Math.RangeRandom(0.5f, 1.0f); float b = Mogre.Math.RangeRandom(0.5f, 1.0f); this.colour = new ColourValue(r, g, b); this.wireObject = Engine.Graphics.SceneManager.CreateManualObject(); this.wireObject.VisibilityFlags = ViewportController.VF_ORTHOGRAPHIC; this.wireObject.UserObject = this; DrawWire(false); SceneNode sceneNode = Engine.Graphics.SceneManager.RootSceneNode.CreateChildSceneNode(); sceneNode.AttachObject(solidObject); sceneNode.AttachObject(wireObject); }
public Element(Vector3 position, float width, float texCoord, ColourValue colour, Quaternion orientation) : this(OgrePINVOKE.new_BillboardChain_Element__SWIG_1(Vector3.getCPtr(position), width, texCoord, ColourValue.getCPtr(colour), Quaternion.getCPtr(orientation)), true) { if (OgrePINVOKE.SWIGPendingException.Pending) { throw OgrePINVOKE.SWIGPendingException.Retrieve(); } }
public SimpleStaticTextButton(string name, string caption, ColourValue normalStateColor, ColourValue activeStateColor, bool specificColor = false) { OverlayManager overlayMgr = OverlayManager.Singleton; element = overlayMgr.CreateOverlayElement("BorderPanel", name); element.MetricsMode = GuiMetricsMode.GMM_RELATIVE; element.HorizontalAlignment = GuiHorizontalAlignment.GHA_LEFT; element.Height = 0.32f; mTextArea = overlayMgr.CreateOverlayElement("TextArea", name + "/StaticTextCaption") as TextAreaOverlayElement; mTextArea.MetricsMode = GuiMetricsMode.GMM_RELATIVE; mTextArea.HorizontalAlignment = GuiHorizontalAlignment.GHA_LEFT; mTextArea.SetAlignment(TextAreaOverlayElement.Alignment.Left); mTextArea.Top = 0.01f; mTextArea.FontName = "EngineFont"; mTextArea.CharHeight = 0.025f; mTextArea.SpaceWidth = 0.02f; if (!specificColor) { normalStateColor = new ColourValue(0.9f, 1f, 0.7f); } mTextArea.Colour = normalStateColor; ((OverlayContainer)element).AddChild(mTextArea); Text = caption; AssignListener(UILayer.Instance.Listener); this.normalStateColor = normalStateColor; this.activeStateColor = activeStateColor; mState = ButtonState.BS_UP; }
public void Update(float timeSinceLastFrame) { for (int i = 0; i < textElements.Count; i++) { var itr = textElements[i]; alphaSinceLastFrame = itr.Colour.a; if (alphaSinceLastFrame > 0.0f) { if (delay > 0) { delay--; } else { alphaSinceLastFrame -= 0.01f; delay = 20; ColourValue cv = new ColourValue( itr.Colour.r, itr.Colour.g, itr.Colour.b, float.Parse(alphaSinceLastFrame.ToString("0.00"))); itr.Colour = cv; } } if (alphaSinceLastFrame == 0.0f) { OverlayManager.Singleton.DestroyOverlayElement(itr); textElements.Remove(itr); } } }
public override void CreateScene() { ColourValue fadeColour = new ColourValue(0.9f, 0.9f, 0.9f); base.sceneMgr.SetFog(FogMode.FOG_LINEAR, fadeColour, 0, 100, 900); //base.sceneMgr.SetFog(FogMode.FOG_EXP, fadeColour, 0.009f); base.viewport.BackgroundColour = fadeColour; Plane plane; plane.d = 100; plane.normal = Vector3.NEGATIVE_UNIT_Y; base.sceneMgr.SetWorldGeometry("terrain.cfg"); base.sceneMgr.SetSkyPlane(true, plane, "Examples/CloudySky", 500, 20, true, 0.5f, 150, 150); //FSLSoundObject backgroundSound = soundManager.CreateAmbientSound("../../media/sound/windy1.ogg", "Ambiente1", true); //Create Ambient sound //backgroundSound.Play(); //BoidMesh.CreateBoidMesh("myBoid_green", "green"); //BoidMesh.CreateBoidMesh("myBoid_red", "red"); boidNodesList = new List<SceneNode>(); for (int i = 0; i < boidsManager.KnownBoidsList.Count; i++) { AddNewBoid(boidsManager.KnownBoidsList[i]); } boidsManager.OnNewBoid += new AddNewBoid(AddNewBoid); }
public override void enter() { AdvancedMogreFramework.Singleton.m_pLog.LogMessage("Entering GameState..."); AdvancedMogreFramework.lastState = "GameState"; m_pSceneMgr = AdvancedMogreFramework.Singleton.m_pRoot.CreateSceneManager(SceneType.ST_GENERIC, "GameSceneMgr"); ColourValue cvAmbineLight = new ColourValue(0.7f, 0.7f, 0.7f); m_pSceneMgr.AmbientLight = cvAmbineLight;//(Ogre::ColourValue(0.7f, 0.7f, 0.7f)); Ray r = new Ray(); m_pRSQ = m_pSceneMgr.CreateRayQuery(r); m_pRSQ.QueryMask = 1 << 0; m_pCamera = m_pSceneMgr.CreateCamera("GameCamera"); Mogre.Vector3 vectCameraPostion = new Mogre.Vector3(5, 60, 60); m_pCamera.Position = vectCameraPostion; Mogre.Vector3 vectorCameraLookAt = new Mogre.Vector3(5, 20, 0); m_pCamera.LookAt(vectorCameraLookAt); m_pCamera.NearClipDistance = 5; m_pCamera.AspectRatio = AdvancedMogreFramework.Singleton.m_pViewport.ActualWidth / AdvancedMogreFramework.Singleton.m_pViewport.ActualHeight; AdvancedMogreFramework.Singleton.m_pViewport.Camera = m_pCamera; m_pCurrentObject = null; buildGUI(); createScene(); }
protected void InitLights(ColourValue c1, ColourValue c2) { Billboard lightbillboard; BillboardSet lightbillboardset = sceneMgr.CreateBillboardSet(name + "_lights", 1); lightbillboardset.MaterialName = "Effects/Flare"; if (!EngineConfig.LowDetails) { lightbillboard = lightbillboardset.CreateBillboard(-9.2f, 12.5f, -5.1f - 47.5f, c1); lightbillboard.SetDimensions(2, 2); Light light = sceneMgr.CreateLight(name + "_light1"); light.Type = Light.LightTypes.LT_POINT; light.SetAttenuation(30.0f, 0.0f, 1.0f, 0.00f); light.DiffuseColour = new ColourValue(0.5f, 0.0f, 0.0f); light.SpecularColour = new ColourValue(0.05f, 0.05f, 0.05f); light.CastShadows = true; SceneNode lightNode = mainNode.CreateChildSceneNode(new Vector3(-9.2f, 12.5f, -4.0f - 5.1f - 47.5f)); lightNode.AttachObject(light); } lightbillboard = lightbillboardset.CreateBillboard(-10.7f, 12.3f, 12.6f - 47.5f, c2); lightbillboard.SetDimensions(2, 2); mainNode.AttachObject(lightbillboardset); //sceneMgr.ShowBoundingBoxes = true; }
public Billboard(Vector3 position, BillboardSet owner, ColourValue colour) : this(OgrePINVOKE.new_Billboard__SWIG_1(Vector3.getCPtr(position), BillboardSet.getCPtr(owner), ColourValue.getCPtr(colour)), true) { if (OgrePINVOKE.SWIGPendingException.Pending) { throw OgrePINVOKE.SWIGPendingException.Retrieve(); } }
public void setFog(bool overrideScene, FogMode mode, ColourValue colour, float expDensity, float linearStart) { OgrePINVOKE.Technique_setFog__SWIG_1(swigCPtr, overrideScene, (int)mode, ColourValue.getCPtr(colour), expDensity, linearStart); if (OgrePINVOKE.SWIGPendingException.Pending) { throw OgrePINVOKE.SWIGPendingException.Retrieve(); } }
public void setSelfIllumination(ColourValue selfIllum) { OgrePINVOKE.Technique_setSelfIllumination__SWIG_1(swigCPtr, ColourValue.getCPtr(selfIllum)); if (OgrePINVOKE.SWIGPendingException.Pending) { throw OgrePINVOKE.SWIGPendingException.Retrieve(); } }
public void setSpecular(ColourValue specular) { OgrePINVOKE.Technique_setSpecular__SWIG_1(swigCPtr, ColourValue.getCPtr(specular)); if (OgrePINVOKE.SWIGPendingException.Pending) { throw OgrePINVOKE.SWIGPendingException.Retrieve(); } }
public void setDiffuse(ColourValue diffuse) { OgrePINVOKE.Technique_setDiffuse__SWIG_1(swigCPtr, ColourValue.getCPtr(diffuse)); if (OgrePINVOKE.SWIGPendingException.Pending) { throw OgrePINVOKE.SWIGPendingException.Retrieve(); } }
public static void ChangeElementColour(OverlayElement element, ColourValue c1, ColourValue c2) { string colour1 = String.Format("{0:f} {1:f} {2:f}", StringConverter.ToString(c1.r), StringConverter.ToString(c1.g), StringConverter.ToString(c1.b)); string colour2 = String.Format("{0:f} {1:f} {2:f}", StringConverter.ToString(c2.r), StringConverter.ToString(c2.g), StringConverter.ToString(c2.b)); element.SetParameter("colour_top", colour1); element.SetParameter("colour_bottom", colour2); }
public void setFog(bool overrideScene, FogMode mode, ColourValue colour) { OgrePINVOKE.Technique_setFog__SWIG_3(swigCPtr, overrideScene, (int)mode, ColourValue.getCPtr(colour)); if (OgrePINVOKE.SWIGPendingException.Pending) { throw OgrePINVOKE.SWIGPendingException.Retrieve(); } }
public void setFogProperties(FogMode fogMode, ColourValue fogColour, float fogStart, float fogEnd, float fogDensity) { RTShaderPINVOKE.FFPFog_setFogProperties(swigCPtr, (int)fogMode, ColourValue.getCPtr(fogColour), fogStart, fogEnd, fogDensity); if (RTShaderPINVOKE.SWIGPendingException.Pending) { throw RTShaderPINVOKE.SWIGPendingException.Retrieve(); } }
public virtual void colour(ColourValue col) { OgrePINVOKE.ManualObject_colour__SWIG_0(swigCPtr, ColourValue.getCPtr(col)); if (OgrePINVOKE.SWIGPendingException.Pending) { throw OgrePINVOKE.SWIGPendingException.Retrieve(); } }
public void setFog(bool overrideScene, FogMode mode, ColourValue colour, float expDensity) { OgrePINVOKE.MaterialPtr_setFog__SWIG_2(swigCPtr, overrideScene, (int)mode, ColourValue.getCPtr(colour), expDensity); if (OgrePINVOKE.SWIGPendingException.Pending) { throw OgrePINVOKE.SWIGPendingException.Retrieve(); } }
private void SetFog() { ColourValue fadeColour = new ColourValue(0.1f, 0.1f, 1f); //mSceneMgr.SetFog(FogMode.FOG_LINEAR, fadeColour, 0.1f, 100, 1000); //mSceneMgr.SetFog(FogMode.FOG_EXP, fadeColour, 0.001f); mSceneMgr.SetFog(FogMode.FOG_EXP2, fadeColour, 0.002f); mWindow.GetViewport(0).BackgroundColour = fadeColour; }
public void setAmbient(ColourValue ambient) { OgrePINVOKE.Technique_setAmbient__SWIG_1(swigCPtr, ColourValue.getCPtr(ambient)); if (OgrePINVOKE.SWIGPendingException.Pending) { throw OgrePINVOKE.SWIGPendingException.Retrieve(); } }
public static void ColorMaterialWithZone(MaterialPtr eMat, Zones z) { eMat.SetSceneBlending(SceneBlendType.SBT_TRANSPARENT_ALPHA); ColourValue c = CityManager.GetZoneColor(z); eMat.SetDiffuse(c.r, c.g, c.b, 0.5f); eMat.SetDepthWriteEnabled(false); }
public void setColour(ColourValue colour) { OgrePINVOKE.Billboard_setColour(swigCPtr, ColourValue.getCPtr(colour)); if (OgrePINVOKE.SWIGPendingException.Pending) { throw OgrePINVOKE.SWIGPendingException.Retrieve(); } }
public TextLabel3D NewTextLabel3D( String fontName, float fontSize, ColourValue colourtop, ColourValue colourbottom, int layer) { TextLabel3D textLabel = new TextLabel3D( GetUniqueLabelName(), fontName, fontSize, colourtop, colourbottom); Panels[layer].AddChild(textLabel.TextArea); Labels.Add(textLabel); return textLabel; }
public SimpleQuad NewSimpleQuad(string materialName, float left, float top, float width, float height, ColourValue colour, int layer) { SimpleQuad quad = new SimpleQuad(GetUniqueLabelName(), materialName, left, top, width, height, colour); Overlays[layer].Add2D(quad.Panel); Quads.Add(quad); return quad; }
public int AddToVertices(LinkedList<KeyValuePair<Vector3, ColourValue>> tarGet, Vector3 position, ColourValue colour, float scale) { Matrix4 transform = Matrix4.IDENTITY; transform.SetTrans(position); transform.SetScale(new Vector3(scale, scale, scale)); for (int i = 0; i <= System.Convert.ToInt32(vertices.Count) - 1; i++) { tarGet.AddLast(new KeyValuePair<Vector3, ColourValue>(transform * vertices[i], colour)); } return vertices.Count; }
public SimpleQuad(String name, String materialName, float left, float top, float width, float height, ColourValue colour) { Panel = OverlayManager.Singleton.CreateOverlayElement("Panel", name) as OverlayContainer; Panel.MetricsMode = GuiMetricsMode.GMM_RELATIVE; Panel.SetDimensions(width, height); Panel.SetPosition(left, top); Panel.MaterialName = materialName; Panel.Colour = colour; }
public ForceBall(SceneManager sceneManager, MogreNewt.World physicsWorld, float tempSize, int own) { MogreNewt.ConvexCollision col; Mogre.Vector3 offset; Mogre.Vector3 inertia; unique++; // Create the visible mesh (no physics) ent = sceneManager.CreateEntity("forceball" + unique, "Sph.mesh"); sn = sceneManager.RootSceneNode.CreateChildSceneNode(); sn.AttachObject(ent); Console.WriteLine("end ball create"); size = tempSize; sn.SetScale(size, size, size); // Create the collision hull col = new MogreNewt.CollisionPrimitives.ConvexHull(physicsWorld, sn); col.calculateInertialMatrix(out inertia, out offset); // Create the physics body. This body is what you manipulate. The graphical Ogre scenenode is automatically synced with the physics body body = new MogreNewt.Body(physicsWorld, col); col.Dispose(); //body.setPositionOrientation(new Vector3(0, 10, 0), Quaternion.IDENTITY); body.attachToNode(sn); body.setContinuousCollisionMode(1); body.setMassMatrix(mass, mass * inertia); body.IsGravityEnabled = true; body.setUserData(this); trail = sceneManager.CreateParticleSystem("awesome" + StringConverter.ToString(unique), "Char/Smoke"); trail.CastShadows = true; trail.GetEmitter(0).EmissionRate = 100; sn.AttachObject(trail); Console.WriteLine("player stuff"); owner = own; Player tempP = (Player)Program.p1; colour = tempP.cv; }
// Just override the mandatory create scene method public override void CreateScene() { // Set ambient light sceneMgr.AmbientLight = new ColourValue(0.5f, 0.5f, 0.5f); // Create a light Light l = sceneMgr.CreateLight("MainLight"); // Accept default settings: point light, white diffuse, just set position // NB I could attach the light to a SceneNode if I wanted it to move automatically with // other objects, but I don't l.SetPosition(20,80,50); // Fog // NB it's VERY important to set this before calling setWorldGeometry // because the vertex program picked will be different ColourValue fadeColour = new ColourValue(0.93f, 0.86f, 0.76f); sceneMgr.SetFog(FogMode.FOG_LINEAR, fadeColour, .001f, 500, 1000); window.GetViewport(0).BackgroundColour = fadeColour; string terrain_cfg = "terrain.cfg"; sceneMgr.SetWorldGeometry( terrain_cfg ); // Infinite far plane? if (root.RenderSystem.Capabilities.HasCapability(Capabilities.RSC_INFINITE_FAR_PLANE)) { camera.FarClipDistance = 0; } // Define the required skyplane Plane plane; // 5000 world units from the camera plane.d = 5000; // Above the camera, facing down plane.normal = -Vector3.UNIT_Y; // Set a nice viewpoint camera.SetPosition(707,2500,528); camera.Orientation = new Quaternion(-0.3486f, 0.0122f, 0.9365f, 0.0329f); //mRoot -> showDebugOverlay( true ); raySceneQuery = sceneMgr.CreateRayQuery( new Ray(camera.Position, Vector3.NEGATIVE_UNIT_Y)); }
public override void ProcessParameters(NameValuePairList parameters) { NameValuePairList.Iterator ni; if ((ni = parameters.Find("Name")) != parameters.End()) this.name = ni.Value; if ((ni = parameters.Find("Position")) != parameters.End()) this.position = StringConverter.ParseVector3(ni.Value); if ((ni = parameters.Find("Orientation")) != parameters.End()) this.orientation = StringConverter.ParseQuaternion(ni.Value); if ((ni = parameters.Find("Direction")) != parameters.End()) this.direction = StringConverter.ParseVector3(ni.Value); if ((ni = parameters.Find("LightType")) != parameters.End()) this.lightType = (Light.LightTypes)Enum.Parse(typeof(Light.LightTypes), ni.Value); if ((ni = parameters.Find("Diffuse")) != parameters.End()) this.diffuse = StringConverter.ParseColourValue(ni.Value); if ((ni = parameters.Find("Specular")) != parameters.End()) this.specular = StringConverter.ParseColourValue(ni.Value); if ((ni = parameters.Find("LightRange")) != parameters.End()) this.range = StringConverter.ParseVector3(ni.Value); if ((ni = parameters.Find("Attenuation")) != parameters.End()) this.attenuation = MogreX.StringConverter.ParseVector4(ni.Value); if ((ni = parameters.Find("Power")) != parameters.End()) this.power = StringConverter.ParseReal(ni.Value); if ((ni = parameters.Find("CastShadows")) != parameters.End()) this.castShadows = StringConverter.ParseBool(ni.Value); }
/// <param name="__unnamed003">no idea</param> /// <param name="__unnamed004">no idea</param> /// <param name="__unnamed005">no idea</param> public void DrawTriangle(Vector3 v0, Vector3 v1, Vector3 v2, Vector3 __unnamed003, Vector3 __unnamed004, Vector3 __unnamed005, ColourValue colour, float alpha) { if (DrawCondition(v0)) return; DrawTriangle(v0, v1, v2, colour, alpha); }
/// <param name="__unnamed004">alpha?</param> public void DrawTriangle(Vector3 v0, Vector3 v1, Vector3 v2, ColourValue colour, float __unnamed004) { if (DrawCondition(v0)) return; triangles.Position(v0); triangles.Colour(colour); triangles.Position(v1); triangles.Colour(colour); triangles.Position(v2); triangles.Colour(colour); }
public void DrawSpherePatch(Vector3 center, Vector3 up, Vector3 axis, float radius, float minTh, float maxTh, float minPs, float maxPs, ColourValue colour) { }
/// <summary> /// Draws an axis-aligned bounding box /// </summary> /// <param name="colour"> /// I override this and make it white with 30% opacity /// </param> public void DrawAabb(Vector3 from, Vector3 to, ColourValue colour) { if (!begin || DrawCondition(from)) return; colour = new ColourValue(1f, 1f, 1f, 0.3f); // I'm sure there's a better way of doing this Vector3 loo = new Vector3(to.x, from.y, from.z); Vector3 olo = new Vector3(from.x, to.y, from.z); Vector3 ool = new Vector3(from.x, from.y, to.z); Vector3 llo = new Vector3(to.x, to.y, from.z); Vector3 lol = new Vector3(to.x, from.y, to.z); Vector3 oll = new Vector3(from.x, to.y, to.z); lines.Position(from); lines.Colour(colour); lines.Position(loo); lines.Colour(colour); lines.Position(from); lines.Colour(colour); lines.Position(olo); lines.Colour(colour); lines.Position(from); lines.Colour(colour); lines.Position(ool); lines.Colour(colour); lines.Position(to); lines.Colour(colour); lines.Position(llo); lines.Colour(colour); lines.Position(to); lines.Colour(colour); lines.Position(lol); lines.Colour(colour); lines.Position(to); lines.Colour(colour); lines.Position(oll); lines.Colour(colour); lines.Position(loo); lines.Colour(colour); lines.Position(lol); lines.Colour(colour); lines.Position(lol); lines.Colour(colour); lines.Position(ool); lines.Colour(colour); lines.Position(ool); lines.Colour(colour); lines.Position(oll); lines.Colour(colour); lines.Position(oll); lines.Colour(colour); lines.Position(olo); lines.Colour(colour); lines.Position(olo); lines.Colour(colour); lines.Position(llo); lines.Colour(colour); lines.Position(llo); lines.Colour(colour); lines.Position(loo); lines.Colour(colour); }
public Block(ColourValue clr) : base(ImageFromColour(clr)) { }
/// <summary> /// Draws a cylinder /// </summary> /// <param name="upAxis"> /// no idea what this is even for /// </param> public void DrawCylinder(float radius, float halfHeight, int upAxis, Matrix4 transform, ColourValue colour) { if (DrawCondition(transform)) return; Vector3 previousPos = transform * new Vector3(0, halfHeight, radius); Vector3 previousNPos = transform * new Vector3(0, -halfHeight, radius); for (float a = 0; a <= limit; a += increaseAmount) { float z = Math.Cos(a) * radius; float x = Math.Sin(a) * radius; // positive Vector3 pos = transform * new Vector3(x, halfHeight, z); lines.Position(previousPos); lines.Colour(colour); lines.Position(pos); lines.Colour(colour); previousPos = pos; // negative Vector3 npos = transform * new Vector3(x, -halfHeight, z); lines.Position(previousNPos); lines.Colour(colour); lines.Position(npos); lines.Colour(colour); previousNPos = npos; // the sides lines.Position(pos); lines.Colour(colour); lines.Position(npos); lines.Colour(colour); } }
/// <summary> /// This doesn't seem to even work half the time /// </summary> public void DrawContactPoint(Vector3 pointOnB, Vector3 normalOnB, float distance, int lifeTime, ColourValue colour) { //if (DrawCondition(pointOnB)) // return; lines.Position(pointOnB); lines.Colour(colour); lines.Position(pointOnB + normalOnB * distance); lines.Colour(colour); }
/// <summary> /// Draws a cylinder, then draws two half-spheres on the top and bottom /// </summary> public void DrawCapsule(float radius, float halfHeight, int upAxis, Matrix4 transform, ColourValue colour) { if (DrawCondition(transform)) return; DrawCylinder(radius, halfHeight, upAxis, transform, colour); Vector3 previousXYPos = transform * new Vector3(radius, halfHeight, 0); Vector3 previousYZPos = transform * new Vector3(0, halfHeight, radius); Vector3 previousNXYPos = transform * new Vector3(radius, -halfHeight, 0); Vector3 previousNYZPos = transform * new Vector3(0, -halfHeight, radius); float capsuleLimit = limit * 0.5f; // y-x circle for (float a = 0; a <= capsuleLimit; a += increaseAmount) { float y = Math.Sin(a) * radius; float x = Math.Cos(a) * radius; // xy Vector3 xyPos = transform * new Vector3(x, y + halfHeight, 0); lines.Position(previousXYPos); lines.Colour(colour); lines.Position(xyPos); lines.Colour(colour); previousXYPos = xyPos; // yz float z = Math.Cos(a) * radius; Vector3 yzPos = transform * new Vector3(0, y + halfHeight, z); lines.Position(previousYZPos); lines.Colour(colour); lines.Position(yzPos); lines.Colour(colour); previousYZPos = yzPos; // -xy Vector3 nxyPos = transform * new Vector3(x, -y - halfHeight, 0); lines.Position(previousNXYPos); lines.Colour(colour); lines.Position(nxyPos); lines.Colour(colour); previousNXYPos = nxyPos; // -yz Vector3 nyzPos = transform * new Vector3(0, -y - halfHeight, z); lines.Position(previousNYZPos); lines.Colour(colour); lines.Position(nyzPos); lines.Colour(colour); previousNYZPos = nyzPos; } }
public void DrawBox(Vector3 bbMin, Vector3 bbMax, ColourValue colour) { if (DrawCondition(bbMin)) return; Vector3 loo = new Vector3(bbMin.x, bbMax.y, bbMax.z); Vector3 olo = new Vector3(bbMax.x, bbMin.y, bbMax.z); Vector3 ool = new Vector3(bbMax.x, bbMax.y, bbMin.z); Vector3 llo = new Vector3(bbMin.x, bbMin.y, bbMax.z); Vector3 lol = new Vector3(bbMin.x, bbMax.y, bbMin.z); Vector3 oll = new Vector3(bbMax.x, bbMin.y, bbMin.z); lines.Position(bbMax); lines.Colour(colour); lines.Position(loo); lines.Colour(colour); lines.Position(bbMax); lines.Colour(colour); lines.Position(olo); lines.Colour(colour); lines.Position(bbMax); lines.Colour(colour); lines.Position(ool); lines.Colour(colour); lines.Position(bbMin); lines.Colour(colour); lines.Position(llo); lines.Colour(colour); lines.Position(bbMin); lines.Colour(colour); lines.Position(lol); lines.Colour(colour); lines.Position(bbMin); lines.Colour(colour); lines.Position(oll); lines.Colour(colour); lines.Position(loo); lines.Colour(colour); lines.Position(lol); lines.Colour(colour); lines.Position(lol); lines.Colour(colour); lines.Position(ool); lines.Colour(colour); lines.Position(ool); lines.Colour(colour); lines.Position(oll); lines.Colour(colour); lines.Position(oll); lines.Colour(colour); lines.Position(olo); lines.Colour(colour); lines.Position(olo); lines.Colour(colour); lines.Position(llo); lines.Colour(colour); lines.Position(llo); lines.Colour(colour); lines.Position(loo); lines.Colour(colour); }
public void DrawBox(Vector3 bbMin, Vector3 bbMax, Matrix4 trans, ColourValue colour) { Vector3 origin = trans.GetTrans(); if (DrawCondition(origin)) return; Vector3 loo = trans * new Vector3(bbMin.x, bbMax.y, bbMax.z); Vector3 olo = trans * new Vector3(bbMax.x, bbMin.y, bbMax.z); Vector3 ool = trans * new Vector3(bbMax.x, bbMax.y, bbMin.z); Vector3 llo = trans * new Vector3(bbMin.x, bbMin.y, bbMax.z); Vector3 lol = trans * new Vector3(bbMin.x, bbMax.y, bbMin.z); Vector3 oll = trans * new Vector3(bbMax.x, bbMin.y, bbMin.z); bbMin = trans * bbMin; bbMax = trans * bbMax; lines.Position(bbMax); lines.Colour(colour); lines.Position(loo); lines.Colour(colour); lines.Position(bbMax); lines.Colour(colour); lines.Position(olo); lines.Colour(colour); lines.Position(bbMax); lines.Colour(colour); lines.Position(ool); lines.Colour(colour); lines.Position(bbMin); lines.Colour(colour); lines.Position(llo); lines.Colour(colour); lines.Position(bbMin); lines.Colour(colour); lines.Position(lol); lines.Colour(colour); lines.Position(bbMin); lines.Colour(colour); lines.Position(oll); lines.Colour(colour); lines.Position(loo); lines.Colour(colour); lines.Position(lol); lines.Colour(colour); lines.Position(lol); lines.Colour(colour); lines.Position(ool); lines.Colour(colour); lines.Position(ool); lines.Colour(colour); lines.Position(oll); lines.Colour(colour); lines.Position(oll); lines.Colour(colour); lines.Position(olo); lines.Colour(colour); lines.Position(olo); lines.Colour(colour); lines.Position(llo); lines.Colour(colour); lines.Position(llo); lines.Colour(colour); lines.Position(loo); lines.Colour(colour); }
public void DrawArc(Vector3 center, Vector3 normal, Vector3 axis, float radiusA, float radiusB, float minAngle, float maxAngle, ColourValue colour, bool drawSect) { }
public void updateMenu() { spinCounter += 0.04f; seltop = new ColourValue((Mogre.Math.Sin(spinCounter) + 1)/2, 0.7f, 0.7f); for (int i = 0; i < 10; i++) { optionAreas[i].ColourTop = top; optionAreas[i].ColourBottom = bot; } optionAreas[Program.Instance.gameManager.menuOption].ColourBottom = selbot; optionAreas[Program.Instance.gameManager.menuOption].ColourTop = seltop; }
/// <summary> /// Draws a line /// </summary> public void DrawLine(Vector3 from, Vector3 to, ColourValue fromcolour, ColourValue tocolour) { if (DrawCondition(from)) return; lines.Position(from); lines.Colour(fromcolour); lines.Position(to); lines.Colour(tocolour); }
public void DrawPlane(Vector3 planeNormal, float planeConst, Matrix4 transform, ColourValue colour) { }
public static BitmapImage ImageFromColour(ColourValue clr) { return bmps[(int)clr]; }
/// <summary> /// Draws a sphere that does rotate /// </summary> public void DrawSphere(float radius, Matrix4 transform, ColourValue colour) { if (DrawCondition(transform)) return; Vector3 previousXYPos = transform * new Vector3(0, radius, 0); Vector3 previousYZPos = transform * new Vector3(0, radius, 0); Vector3 previousXZPos = transform * new Vector3(0, 0, radius); for (float a = 0; a <= limit; a += increaseAmount) { float y = Math.Cos(a) * radius; float x = Math.Sin(a) * radius; // xy Vector3 xyPos = transform * new Vector3(x, y, 0); lines.Position(previousXYPos); lines.Colour(colour); lines.Position(xyPos); lines.Colour(colour); previousXYPos = xyPos; // yz float z = Math.Sin(a) * radius; Vector3 yzPos = transform * new Vector3(0, y, z); lines.Position(previousYZPos); lines.Colour(colour); lines.Position(yzPos); lines.Colour(colour); previousYZPos = yzPos; // xz z = Math.Cos(a) * radius; Vector3 xzPos = transform * new Vector3(x, 0, z); lines.Position(previousXZPos); lines.Colour(colour); lines.Position(xzPos); lines.Colour(colour); previousXZPos = xzPos; } }
// * // Default constructor. // \param pBuffer Image buffer where to modify the image. // public CircleTexture(TextureBuffer pBuffer) : base(pBuffer, "CircleTexture") { mColour = ColourValue.White; mRadius = (int)System.Math.Min(pBuffer.getWidth(), pBuffer.getHeight()) / 2; mX = mRadius; mY = mRadius; }
public void LogAdd(string what, ColourValue color) { LogList.Insert(0, new Pair<string, ColourValue>(what, color)); LogList.RemoveAt(8); }
public OverlayGUI() { //setup the colours top = new ColourValue(0.9f, 0.9f, 0.9f); bot = new ColourValue(0.8f, 0.8f, 0.8f); seltop = new ColourValue(0.9f, 0.7f, 0.7f); selbot = new ColourValue(0.8f, 0.6f, 0.6f); //Overlay overlayManager = OverlayManager.Singleton; // Create a panel panel = (OverlayContainer)overlayManager.CreateOverlayElement("Panel", "PanelName"); panel.MetricsMode = GuiMetricsMode.GMM_PIXELS; panel.SetPosition(0, 0); panel.SetDimensions(Program.Instance.rWindow.Width, Program.Instance.rWindow.Height); panel.MaterialName = "fsO/Blank"; // Optional background material // Create a text area messageArea = (TextAreaOverlayElement)overlayManager.CreateOverlayElement("TextArea", "TextArea"); messageArea.MetricsMode = GuiMetricsMode.GMM_PIXELS; messageArea.SetPosition(0, 0); messageArea.SetDimensions(Program.Instance.rWindow.Width, 100); messageArea.CharHeight = 24; messageArea.FontName = "damn"; messageArea.ColourTop = top; messageArea.ColourBottom = bot; messageArea.Caption = ""; // Status text area statArea = (TextAreaOverlayElement)overlayManager.CreateOverlayElement("TextArea", "StatTextArea"); statArea.MetricsMode = GuiMetricsMode.GMM_PIXELS; statArea.SetPosition(0, Program.Instance.rWindow.Height - 50); statArea.SetDimensions(Program.Instance.rWindow.Width, 50); statArea.CharHeight = 24; statArea.FontName = "damn"; statArea.ColourTop = top; statArea.ColourBottom = bot; statArea.Caption = "this is a test" + Environment.NewLine + "This is the test's second line"; //Menus Text Areas titleArea = (TextAreaOverlayElement)overlayManager.CreateOverlayElement("TextArea", "TitleTextArea"); titleArea.MetricsMode = GuiMetricsMode.GMM_PIXELS; titleArea.SetPosition(64, 16); titleArea.SetDimensions(Program.Instance.rWindow.Width, 32); titleArea.CharHeight = 32; titleArea.FontName = "damn"; titleArea.ColourTop = top; titleArea.ColourBottom = bot; titleArea.Caption = "Title"; for (int i = 0; i < 10; i++) { optionAreas[i] = (TextAreaOverlayElement)overlayManager.CreateOverlayElement("TextArea", i+"TextArea"); optionAreas[i].MetricsMode = GuiMetricsMode.GMM_PIXELS; optionAreas[i].SetPosition(32, 64 + (i*26)); optionAreas[i].SetDimensions(Program.Instance.rWindow.Width, 24); optionAreas[i].CharHeight = 24; optionAreas[i].FontName = "damn"; optionAreas[i].ColourTop = top; optionAreas[i].ColourBottom = bot; optionAreas[i].Caption = "Option " + i.ToString(); } maxOptions = 10; // Create an overlay, and add the panel overlay = overlayManager.Create("OverlayName"); overlay.Add2D(panel); // Add the text area to the panel panel.AddChild(messageArea); panel.AddChild(titleArea); panel.AddChild(statArea); for (int i = 0; i < 10; i++) { panel.AddChild(optionAreas[i]); } // Show the overlay overlay.Show(); }
// * // Set the fill colour of the circle. // \param colour New colour for processing (default Ogre::ColourValue::White) // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public CircleTexture setColour(ColourValue colour) { // //ORIGINAL LINE: mColour = colour; mColour = (colour); return this; }