diff --git a/StgSharp.Common/Controlling/Controls/BattleField.cs b/StgSharp.Common/Controlling/Controls/BattleField.cs index 24652f68..3849f30f 100644 --- a/StgSharp.Common/Controlling/Controls/BattleField.cs +++ b/StgSharp.Common/Controlling/Controls/BattleField.cs @@ -32,6 +32,7 @@ using StgSharp.Geometries; using StgSharp.Graphics; using StgSharp.Mathematics; +using StgSharp.Mathematics.Graphic; using System; using System.Collections.Generic; diff --git a/StgSharp.Common/Controlling/Controls/ButtonGroup.cs b/StgSharp.Common/Controlling/Controls/ButtonGroup.cs index e826d058..eb3992b0 100644 --- a/StgSharp.Common/Controlling/Controls/ButtonGroup.cs +++ b/StgSharp.Common/Controlling/Controls/ButtonGroup.cs @@ -1,36 +1,34 @@ //----------------------------------------------------------------------- -//----------------------------------------------------------------------- -// file="ButtonGroup.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. +// ----------------------------------------------------------------------- +// file="ButtonGroup" +// Project: StgSharp +// AuthorGroup: Nitload Space +// Copyright (c) Nitload Space. All rights reserved. // -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -//----------------------------------------------------------------------- -//----------------------------------------------------------------------- +// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- using StgSharp.Geometries; using StgSharp.Graphics; using StgSharp.Mathematics; +using StgSharp.Mathematics.Graphic; using System; using System.Collections.Generic; @@ -77,16 +75,16 @@ namespace StgSharp.Controls get => buttonList; } - public void AddButton( TriggerButton button ) + public void AddButton(TriggerButton button) { - buttonList.Add( button ); + buttonList.Add(button); } public abstract void Confirm(); public IEnumerator GetEnumerator() { - foreach( TriggerButton item in buttonList ) { + foreach (TriggerButton item in buttonList) { yield return item.Single(); } } @@ -94,10 +92,10 @@ namespace StgSharp.Controls public void MoveDown() { TriggerButton button = current; - while( ( button.Down != null ) && button.Down.IsDisabled ) { + while ((button.Down != null) && button.Down.IsDisabled) { button = button.Right; } - if( current == button ) { + if (current == button) { return; } current.DeHighlight(); @@ -108,10 +106,10 @@ namespace StgSharp.Controls public void MoveLeft() { TriggerButton button = current; - while( ( button.Left != null ) && button.Left.IsDisabled ) { + while ((button.Left != null) && button.Left.IsDisabled) { button = button.Left; } - if( current == button ) { + if (current == button) { return; } current.DeHighlight(); @@ -122,10 +120,10 @@ namespace StgSharp.Controls public void MoveRight() { TriggerButton button = current; - while( ( button.Right != null ) && button.Right.IsDisabled ) { + while ((button.Right != null) && button.Right.IsDisabled) { button = button.Right; } - if( current == button ) { + if (current == button) { return; } current.DeHighlight(); @@ -136,10 +134,10 @@ namespace StgSharp.Controls public void MoveUp() { TriggerButton button = current; - while( ( button.Up != null ) && button.Up.IsDisabled ) { + while ((button.Up != null) && button.Up.IsDisabled) { button = button.Right; } - if( current == button ) { + if (current == button) { return; } current.DeHighlight(); diff --git a/StgSharp.Common/Controlling/Controls/CharacterIndexImage.cs b/StgSharp.Common/Controlling/Controls/CharacterIndexImage.cs index 9867a7ea..ef696ef0 100644 --- a/StgSharp.Common/Controlling/Controls/CharacterIndexImage.cs +++ b/StgSharp.Common/Controlling/Controls/CharacterIndexImage.cs @@ -1,36 +1,34 @@ //----------------------------------------------------------------------- -//----------------------------------------------------------------------- -// file="CharacterIndexImage.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. +// ----------------------------------------------------------------------- +// file="CharacterIndexImage" +// Project: StgSharp +// AuthorGroup: Nitload Space +// Copyright (c) Nitload Space. All rights reserved. // -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -//----------------------------------------------------------------------- -//----------------------------------------------------------------------- +// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- using StgSharp.Geometries; using StgSharp.Graphics; using StgSharp.Mathematics; +using StgSharp.Mathematics.Graphic; using System; using System.Collections; @@ -55,12 +53,12 @@ namespace StgSharp.Controls int length, char defaultChar, PlainGeometryMesh tittleMesh, - IEnumerable<(char, PlainGeometryMesh)> indexEnumeration ) + IEnumerable<(char, PlainGeometryMesh)> indexEnumeration) { this.length = length; displayIndex = new char[length]; _tittleMesh = tittleMesh; - texIndex = indexEnumeration.ToDictionary( item => item.Item1, item => item.Item2 ); + texIndex = indexEnumeration.ToDictionary(item => item.Item1, item => item.Item2); } public bool IsEntity @@ -85,15 +83,16 @@ namespace StgSharp.Controls set => throw new NotImplementedException(); } - public void Display( string message ) + public void Display(string message) { - if( string.IsNullOrEmpty( message ) ) { + if (string.IsNullOrEmpty(message)) { message = string.Empty; } - string result = ( message.Length >= length ) ? - message.Substring( message.Length - displayIndex.Length ) : message.PadLeft( - length, defaultChar ); + string result = (message.Length >= length) ? + message.Substring(message.Length - displayIndex.Length) : + message.PadLeft( + length, defaultChar); displayIndex = result.ToCharArray(); } @@ -101,8 +100,8 @@ namespace StgSharp.Controls public IEnumerator GetEnumerator() { yield return _tittleMesh; - foreach( char item in displayIndex ) { - yield return texIndex[ item ]; + foreach (char item in displayIndex) { + yield return texIndex[item]; } } diff --git a/StgSharp.Common/Controlling/Controls/ControllingIntem.cs b/StgSharp.Common/Controlling/Controls/ControllingIntem.cs index 4c0dc280..03715888 100644 --- a/StgSharp.Common/Controlling/Controls/ControllingIntem.cs +++ b/StgSharp.Common/Controlling/Controls/ControllingIntem.cs @@ -1,36 +1,33 @@ //----------------------------------------------------------------------- -//----------------------------------------------------------------------- -// file="ControllingIntem.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. +// ----------------------------------------------------------------------- +// file="ControllingIntem" +// Project: StgSharp +// AuthorGroup: Nitload Space +// Copyright (c) Nitload Space. All rights reserved. // -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -//----------------------------------------------------------------------- -//----------------------------------------------------------------------- +// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- using StgSharp.Geometries; using StgSharp.Graphics; -using StgSharp.Mathematics; +using StgSharp.Mathematics.Graphic; using System; using System.Collections; diff --git a/StgSharp.Common/Controlling/Controls/DecorationBox.cs b/StgSharp.Common/Controlling/Controls/DecorationBox.cs index 9679aa12..d202d748 100644 --- a/StgSharp.Common/Controlling/Controls/DecorationBox.cs +++ b/StgSharp.Common/Controlling/Controls/DecorationBox.cs @@ -1,37 +1,35 @@ //----------------------------------------------------------------------- -//----------------------------------------------------------------------- -// file="DecorationBox.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. +// ----------------------------------------------------------------------- +// file="DecorationBox" +// Project: StgSharp +// AuthorGroup: Nitload Space +// Copyright (c) Nitload Space. All rights reserved. // -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -//----------------------------------------------------------------------- -//----------------------------------------------------------------------- +// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- using StgSharp.Controls; using StgSharp.Geometries; using StgSharp.Graphics; using StgSharp.Mathematics; +using StgSharp.Mathematics.Graphic; using System; using System.Collections.Generic; @@ -44,10 +42,10 @@ namespace StgSharp.Controls private PlainGeometryMesh renderMesh; - public DecorationBox( Rectangle bound, Image texture, Vec2[] texCoord ) + public DecorationBox(Rectangle bound, Image texture, Vec2[] texCoord) { renderMesh = new PlainGeometryMesh( - BoundingBox, new TextureProvider( texture, texCoord ) ); + BoundingBox, new TextureProvider(texture, texCoord)); } public bool IsEntity => true; diff --git a/StgSharp.Common/Controlling/Controls/MarkingLable.cs b/StgSharp.Common/Controlling/Controls/MarkingLable.cs index abe391af..cf261ca0 100644 --- a/StgSharp.Common/Controlling/Controls/MarkingLable.cs +++ b/StgSharp.Common/Controlling/Controls/MarkingLable.cs @@ -1,37 +1,35 @@ //----------------------------------------------------------------------- -//----------------------------------------------------------------------- -// file="MarkingLable.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. +// ----------------------------------------------------------------------- +// file="MarkingLable" +// Project: StgSharp +// AuthorGroup: Nitload Space +// Copyright (c) Nitload Space. All rights reserved. // -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -//----------------------------------------------------------------------- -//----------------------------------------------------------------------- +// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- using StgSharp.Controls; using StgSharp.Geometries; using StgSharp.Graphics; using StgSharp.Mathematics; +using StgSharp.Mathematics.Graphic; using StgSharp.Timing; using System; @@ -50,7 +48,7 @@ namespace StgSharp.Controls private Vec2 _currentPosition, _movementVec; - public MarkingLabel( PlainGeometryMesh marker, TimeFunction movement ) + public MarkingLabel(PlainGeometryMesh marker, TimeFunction movement) { this.marker = marker; _movement = movement; @@ -72,16 +70,16 @@ namespace StgSharp.Controls yield return marker; } - public void Move( Vec2 movement ) + public void Move(Vec2 movement) { - if( !_movement.IsComplete ) { - Position = _currentPosition + ( _movement.Calculate() * _movementVec ); + if (!_movement.IsComplete) { + Position = _currentPosition + (_movement.Calculate() * _movementVec); } } - public void MoveTo( Vec2 target ) + public void MoveTo(Vec2 target) { - Move( target - Position ); + Move(target - Position); } } diff --git a/StgSharp.Common/Controlling/Controls/TriggerButton.cs b/StgSharp.Common/Controlling/Controls/TriggerButton.cs index 759e0b7d..5ca04d8b 100644 --- a/StgSharp.Common/Controlling/Controls/TriggerButton.cs +++ b/StgSharp.Common/Controlling/Controls/TriggerButton.cs @@ -1,37 +1,35 @@ //----------------------------------------------------------------------- -//----------------------------------------------------------------------- -// file="TriggerButton.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. +// ----------------------------------------------------------------------- +// file="TriggerButton" +// Project: StgSharp +// AuthorGroup: Nitload Space +// Copyright (c) Nitload Space. All rights reserved. // -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -//----------------------------------------------------------------------- -//----------------------------------------------------------------------- +// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- using StgSharp.Controls; using StgSharp.Geometries; using StgSharp.Graphics; using StgSharp.Mathematics; +using StgSharp.Mathematics.Graphic; using System; using System.Collections.Generic; @@ -40,10 +38,7 @@ using System.Text; namespace StgSharp.Controls { - public delegate void RenderButtonTextureCallback( - ButtonStatus status, - float beginTime, - in TextureProvider texture ); + public delegate void RenderButtonTextureCallback(ButtonStatus status, float beginTime, in TextureProvider texture); public enum ButtonStatus { @@ -55,12 +50,12 @@ namespace StgSharp.Controls Confirm = 0b1000, DisableToEnable = Disable | Enable, - EnableToDisable = -( Enable | DisableToEnable ), + EnableToDisable = -(Enable | DisableToEnable), EnableToHighlight = Enable | Highlight, - HighlightToEnable = -( Enable | Highlight ), + HighlightToEnable = -(Enable | Highlight), - HighlightToDisable = -( Highlight | Disable ), + HighlightToDisable = -(Highlight | Disable), } @@ -106,7 +101,7 @@ namespace StgSharp.Controls { add { - if( _renderButton == null ) + if (_renderButton == null) { _renderButton = value; } else @@ -116,7 +111,7 @@ namespace StgSharp.Controls } remove { - if( _renderButton != null ) { + if (_renderButton != null) { _renderButton -= value; } } @@ -130,7 +125,7 @@ namespace StgSharp.Controls public ReadOnlySpan TextureBox { - get => MemoryMarshal.Cast( _texture.TextureCoordinate ); + get => MemoryMarshal.Cast(_texture.TextureCoordinate); } public Rectangle BoundingBox { get; set; } @@ -155,7 +150,7 @@ namespace StgSharp.Controls public void DeHighlight() { - if( CurrentStatus == ButtonStatus.Highlight ) { + if (CurrentStatus == ButtonStatus.Highlight) { CurrentStatus = ButtonStatus.HighlightToEnable; } } @@ -168,48 +163,48 @@ namespace StgSharp.Controls ButtonStatus.Highlight => ButtonStatus.HighlightToDisable, _ => CurrentStatus, }; - if( disableCallback != null ) { + if (disableCallback != null) { disableCallback(); } } public void Enable() { - if( CurrentStatus == ButtonStatus.Disable ) + if (CurrentStatus == ButtonStatus.Disable) { CurrentStatus = ButtonStatus.DisableToEnable; } else { return; } - if( enableCallback != null ) { + if (enableCallback != null) { enableCallback(); } } public IEnumerator GetEnumerator() { - _renderButton( CurrentStatus, _statusBeginTime, in _texture ); - yield return new PlainGeometryMesh( this.BoundingBox, _texture ); + _renderButton(CurrentStatus, _statusBeginTime, in _texture); + yield return new PlainGeometryMesh(this.BoundingBox, _texture); } public void Highlight() { - if( CurrentStatus == ButtonStatus.Enable ) + if (CurrentStatus == ButtonStatus.Enable) { CurrentStatus |= ButtonStatus.EnableToHighlight; } else { return; } - if( confirmCallback != null ) { + if (confirmCallback != null) { confirmCallback(); } } - internal void Init( ButtonStatus status ) + internal void Init(ButtonStatus status) { - if( CurrentStatus == ButtonStatus.Error ) { + if (CurrentStatus == ButtonStatus.Error) { CurrentStatus = status; } } diff --git a/StgSharp.Common/Entities/IEntity.cs b/StgSharp.Common/Entities/IEntity.cs index 5035acdc..0db4dc36 100644 --- a/StgSharp.Common/Entities/IEntity.cs +++ b/StgSharp.Common/Entities/IEntity.cs @@ -30,6 +30,7 @@ //----------------------------------------------------------------------- using StgSharp.Geometries; using StgSharp.Mathematics; +using StgSharp.Mathematics.Graphic; using System; using System.Collections.Generic; diff --git a/StgSharp.Common/Entities/Launcher.cs b/StgSharp.Common/Entities/Launcher.cs index a4e83a49..f5a7fbe0 100644 --- a/StgSharp.Common/Entities/Launcher.cs +++ b/StgSharp.Common/Entities/Launcher.cs @@ -1,35 +1,33 @@ //----------------------------------------------------------------------- -//----------------------------------------------------------------------- -// file="Launcher.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. +// ----------------------------------------------------------------------- +// file="Launcher" +// Project: StgSharp +// AuthorGroup: Nitload Space +// Copyright (c) Nitload Space. All rights reserved. // -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -//----------------------------------------------------------------------- -//----------------------------------------------------------------------- +// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- using StgSharp.Entities; using StgSharp.Mathematics; +using StgSharp.Mathematics.Graphic; namespace StgSharp { diff --git a/StgSharp.Common/Environment/Platform.cs b/StgSharp.Common/Environment/Platform.cs index 75635e8f..fb241f3a 100644 --- a/StgSharp.Common/Environment/Platform.cs +++ b/StgSharp.Common/Environment/Platform.cs @@ -1,30 +1,27 @@ //----------------------------------------------------------------------- // ----------------------------------------------------------------------- -// file="Platform.cs" +// file="Platform" // Project: StgSharp // AuthorGroup: Nitload Space // Copyright (c) Nitload Space. All rights reserved. // -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // // ----------------------------------------------------------------------- // ----------------------------------------------------------------------- @@ -88,7 +85,6 @@ namespace StgSharp } InternalIO.InitIntrinsicContext(); - MatrixParallel.Init(); } public static void LogError(Exception ex) diff --git a/StgSharp.Common/Geometries/Coordination/CoordinationBase.cs b/StgSharp.Common/Geometries/Coordination/CoordinationBase.cs index 00fc3131..cb2c5b9f 100644 --- a/StgSharp.Common/Geometries/Coordination/CoordinationBase.cs +++ b/StgSharp.Common/Geometries/Coordination/CoordinationBase.cs @@ -1,40 +1,33 @@ //----------------------------------------------------------------------- -//----------------------------------------------------------------------- -// file="CoordinationBase.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. +// ----------------------------------------------------------------------- +// file="CoordinationBase" +// Project: StgSharp +// AuthorGroup: Nitload Space +// Copyright (c) Nitload Space. All rights reserved. // -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -//----------------------------------------------------------------------- -//----------------------------------------------------------------------- -using StgSharp.Mathematics; +// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- +using StgSharp.Mathematics.Graphic; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Runtime.CompilerServices; namespace StgSharp.Geometries { @@ -45,7 +38,7 @@ namespace StgSharp.Geometries private CoordinationBase localCoordination; private Matrix44 coordMat; - public CoordinationBase( CoordinationBase localCoordination ) + public CoordinationBase(CoordinationBase localCoordination) { this.localCoordination = localCoordination; coordMat = new Matrix44(); @@ -53,30 +46,31 @@ namespace StgSharp.Geometries public virtual Point LocalOrigin { - get => new Point( coordMat.colum3.XYZ ); - internal set => coordMat.colum3.XYZ = value.Coord; + get => new Point(coordMat.column3.XYZ); + internal set => coordMat.column3.XYZ = value.Coord; } public virtual Vec3 LocalX { - get => coordMat.colum0.XYZ; - internal set => coordMat.colum0.XYZ = value; + get => coordMat.column0.XYZ; + internal set => coordMat.column0.XYZ = value; } public virtual Vec3 LocalY { - get => coordMat.colum1.XYZ; - internal set => coordMat.colum1.XYZ = value; + get => coordMat.column1.XYZ; + internal set => coordMat.column1.XYZ = value; } public virtual Vec3 LocalZ { - get => coordMat.colum2.XYZ; - set => coordMat.colum2.XYZ = value; + get => coordMat.column2.XYZ; + set => coordMat.column2.XYZ = value; } protected ref Matrix44 CoordMat { + [MethodImpl(MethodImplOptions.AggressiveInlining)] get => ref coordMat; } diff --git a/StgSharp.Common/Geometries/Coordination/PlainCoordinate.cs b/StgSharp.Common/Geometries/Coordination/PlainCoordinate.cs index 0776fcbb..bba1e8f2 100644 --- a/StgSharp.Common/Geometries/Coordination/PlainCoordinate.cs +++ b/StgSharp.Common/Geometries/Coordination/PlainCoordinate.cs @@ -1,34 +1,32 @@ //----------------------------------------------------------------------- -//----------------------------------------------------------------------- -// file="PlainCoordinate.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. +// ----------------------------------------------------------------------- +// file="PlainCoordinate" +// Project: StgSharp +// AuthorGroup: Nitload Space +// Copyright (c) Nitload Space. All rights reserved. // -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -//----------------------------------------------------------------------- -//----------------------------------------------------------------------- +// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- using StgSharp.Mathematics; +using StgSharp.Mathematics.Graphic; using System; using System.Collections.Generic; @@ -40,22 +38,20 @@ namespace StgSharp.Geometries public class PlainCoordinate : CoordinationBase { - private static PlainCoordinate statndardPlainCoordination = new PlainCoordinate( - null, new Point( 0, 0, 0 ), new Vec3( 1, 0, 0 ), new Vec3( 0, 1, 0 ) ); - - public PlainCoordinate( CoordinationBase local, Point origin, Vec3 xAxis, Vec3 yAxis ) - : base( local ) + public PlainCoordinate(CoordinationBase local, Point origin, Vec3 xAxis, Vec3 yAxis) + : base(local) { CoordMat = Matrix44.Unit; - CoordMat.colum0 = new Vec4( xAxis, 0 ); - CoordMat.colum1 = new Vec4( yAxis, 0 ); - CoordMat.colum2 = new Vec4( Linear.Normalize( Vec3.Cross( xAxis, yAxis ) ), 0 ); + CoordMat.column0 = new Vec4(xAxis, 0); + CoordMat.column1 = new Vec4(yAxis, 0); + CoordMat.column2 = new Vec4(Linear.Normalize(Vec3.Cross(xAxis, yAxis)), 0); LocalOrigin = origin; } - public static PlainCoordinate StandardPlainCoordination => statndardPlainCoordination; + public static PlainCoordinate StandardPlainCoordination { get; } = new( + null, new Point(0, 0, 0), new Vec3(1, 0, 0), new Vec3(0, 1, 0)); } } diff --git a/StgSharp.Common/Geometries/Coordination/SpaceCoordinate.cs b/StgSharp.Common/Geometries/Coordination/SpaceCoordinate.cs index 8ee424c0..2c7b1598 100644 --- a/StgSharp.Common/Geometries/Coordination/SpaceCoordinate.cs +++ b/StgSharp.Common/Geometries/Coordination/SpaceCoordinate.cs @@ -1,34 +1,32 @@ //----------------------------------------------------------------------- -//----------------------------------------------------------------------- -// file="SpaceCoordinate.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. +// ----------------------------------------------------------------------- +// file="SpaceCoordinate" +// Project: StgSharp +// AuthorGroup: Nitload Space +// Copyright (c) Nitload Space. All rights reserved. // -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -//----------------------------------------------------------------------- -//----------------------------------------------------------------------- +// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- using StgSharp.Mathematics; +using StgSharp.Mathematics.Graphic; using System; using System.Collections.Generic; @@ -39,13 +37,8 @@ namespace StgSharp.Geometries public class SpaceCoordinate : CoordinationBase { - public SpaceCoordinate( - CoordinationBase localCoordination, - Point origin, - Vec3 xAxis, - Vec3 yAxis, - Vec3 zAxis ) - : base( localCoordination ) { } + public SpaceCoordinate(CoordinationBase localCoordination, Point origin, Vec3 xAxis, Vec3 yAxis, Vec3 zAxis) + : base(localCoordination) { } } } diff --git a/StgSharp.Common/Geometries/GeometryOperation/GeometryOperation.cs b/StgSharp.Common/Geometries/GeometryOperation/GeometryOperation.cs index 630daf1b..a7da22df 100644 --- a/StgSharp.Common/Geometries/GeometryOperation/GeometryOperation.cs +++ b/StgSharp.Common/Geometries/GeometryOperation/GeometryOperation.cs @@ -1,46 +1,40 @@ //----------------------------------------------------------------------- -//----------------------------------------------------------------------- -// file="GeometryOperation.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. +// ----------------------------------------------------------------------- +// file="GeometryOperation" +// Project: StgSharp +// AuthorGroup: Nitload Space +// Copyright (c) Nitload Space. All rights reserved. // -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -//----------------------------------------------------------------------- -//----------------------------------------------------------------------- -using StgSharp.Mathematics; +// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- +using StgSharp.Mathematics.Graphic; using StgSharp.Timing; using System; -using System.Collections.Generic; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -using System.Text; namespace StgSharp.Geometries { -[UnmanagedFunctionPointer( CallingConvention.Cdecl )] - public delegate Vec3 GeometryMotionDelegate( TimeSpanProvider timeSource, out float rotation ); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate Vec3 GeometryMotionDelegate(TimeSpanProvider timeSource, out float rotation); public class GeometryMotion { @@ -54,25 +48,25 @@ namespace StgSharp.Geometries public unsafe GeometryMotion( bool isIncreament, TimeSpanProvider timeSource, - GeometryMotionDelegate motionDelegate ) + GeometryMotionDelegate motionDelegate) { isIncrementMode = isIncreament; time = timeSource; - if( motionDelegate == null ) + if (motionDelegate == null) { - handle = ( IntPtr )( delegate* )&defaultMotion; + handle = (IntPtr)(delegate*)&defaultMotion; movement = defaultMotion; - } else if( motionDelegate.Method.IsStatic ) + } else if (motionDelegate.Method.IsStatic) { sourceIsStatic = true; - handle = Marshal.GetFunctionPointerForDelegate( motionDelegate ); + handle = Marshal.GetFunctionPointerForDelegate(motionDelegate); movement = motionDelegate; } else { movement = motionDelegate; } - //sourceIsStatic = false; + // sourceIsStatic = false; } public bool IsIncrement @@ -82,23 +76,23 @@ namespace StgSharp.Geometries public static GeometryMotion DefaultMotion { - get => new GeometryMotion( true, null, null ); + get => new GeometryMotion(true, null, null); } - public unsafe void RunMotion( ref Vec3 coord, ref float rotation ) + public unsafe void RunMotion(ref Vec3 coord, ref float rotation) { float rot; Vec3 vec; - if( sourceIsStatic ) + if (sourceIsStatic) { - vec = ( ( delegate* unmanaged[Cdecl] )handle )( - time, out rot ); + vec = ((delegate* unmanaged[Cdecl])handle)( + time, out rot); } else { - vec = movement( time, out rot ); + vec = movement(time, out rot); } - if( isIncrementMode ) + if (isIncrementMode) { coord += vec; rotation += rot; @@ -109,7 +103,7 @@ namespace StgSharp.Geometries } } - private static Vec3 defaultMotion( TimeSpanProvider provider, out float rotation ) + private static Vec3 defaultMotion(TimeSpanProvider provider, out float rotation) { rotation = 0; return Vec3.Zero; diff --git a/StgSharp.Common/Geometries/IGeometry.cs b/StgSharp.Common/Geometries/IGeometry.cs index 1c75cb30..3933e689 100644 --- a/StgSharp.Common/Geometries/IGeometry.cs +++ b/StgSharp.Common/Geometries/IGeometry.cs @@ -1,34 +1,35 @@ //----------------------------------------------------------------------- -//----------------------------------------------------------------------- -// file="IGeometry.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. +// ----------------------------------------------------------------------- +// file="IGeometry.cs" +// Project: StgSharp +// AuthorGroup: Nitload Space +// Copyright (c) Nitload Space. All rights reserved. // -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the “Software”), to deal in the Software without restriction, +// including without limitation the rights to use, copy, modify, merge, +// publish, distribute, sublicense, and/or sell copies of the Software, +// and to permit persons to whom the Software is furnished to do so, +// subject to the following conditions: // -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. +// The above copyright notice and +// this permission notice shall be included in all copies +// or substantial portions of the Software. // -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// THE SOFTWARE IS PROVIDED “AS IS”, +// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH +// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -//----------------------------------------------------------------------- -//----------------------------------------------------------------------- +// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- using StgSharp.Mathematics; +using StgSharp.Mathematics.Graphic; using System; using System.Collections.Generic; @@ -42,7 +43,7 @@ namespace StgSharp.Geometries public interface IGeometry { - public Point this[ int index ] { get; set; } + public Point this[int index] { get; set; } #pragma warning disable CA1819 public Vec4[] VertexStream diff --git a/StgSharp.Common/Geometries/IInstancing.cs b/StgSharp.Common/Geometries/IInstancing.cs index 0a0ab4dc..e4d19eec 100644 --- a/StgSharp.Common/Geometries/IInstancing.cs +++ b/StgSharp.Common/Geometries/IInstancing.cs @@ -1,34 +1,32 @@ //----------------------------------------------------------------------- // ----------------------------------------------------------------------- -// file="IInstancing.cs" +// file="IInstancing" // Project: StgSharp // AuthorGroup: Nitload Space // Copyright (c) Nitload Space. All rights reserved. // -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // // ----------------------------------------------------------------------- // ----------------------------------------------------------------------- using StgSharp.Mathematics; +using StgSharp.Mathematics.Graphic; using System; using System.Collections.Generic; @@ -52,8 +50,7 @@ namespace StgSharp.Geometries BufferId] = temp; } } - public float Scale { get { return GlobalBuffer.ScalingList[BufferId]; } set { GlobalBuffer.ScalingList[ - BufferId] = value; } } + public float Scale { get { return GlobalBuffer.ScalingList[BufferId]; } set { GlobalBuffer.ScalingList[BufferId] = value; } } public GeometryMotion Motion { get; set; } @@ -63,9 +60,7 @@ namespace StgSharp.Geometries public Vec3 CenterPositionGlobal { get; internal set; } - public Vec3 Coord { get { return GlobalBuffer.CoordAndRotationList[BufferId].XYZ; } set { GlobalBuffer.CoordAndRotationList[ - BufferId] = new Vec4( - value.reg); } } + public Vec3 Coord { get { return GlobalBuffer.CoordAndRotationList[BufferId].XYZ; } set { GlobalBuffer.CoordAndRotationList[BufferId] = new Vec4(value.reg); } } public void Move() { diff --git a/StgSharp.Common/Geometries/IInstancingBuffer.cs b/StgSharp.Common/Geometries/IInstancingBuffer.cs index d9b88f78..7cd040e1 100644 --- a/StgSharp.Common/Geometries/IInstancingBuffer.cs +++ b/StgSharp.Common/Geometries/IInstancingBuffer.cs @@ -1,34 +1,32 @@ //----------------------------------------------------------------------- -//----------------------------------------------------------------------- -// file="IInstancingBuffer.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. +// ----------------------------------------------------------------------- +// file="IInstancingBuffer" +// Project: StgSharp +// AuthorGroup: Nitload Space +// Copyright (c) Nitload Space. All rights reserved. // -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -//----------------------------------------------------------------------- -//----------------------------------------------------------------------- +// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- using StgSharp.Mathematics; +using StgSharp.Mathematics.Graphic; using System; using System.Collections.Generic; diff --git a/StgSharp.Common/Geometries/PlainGeometry/Define/GeometryOperation.cs b/StgSharp.Common/Geometries/PlainGeometry/Define/GeometryOperation.cs index 94a6bb90..1285e08e 100644 --- a/StgSharp.Common/Geometries/PlainGeometry/Define/GeometryOperation.cs +++ b/StgSharp.Common/Geometries/PlainGeometry/Define/GeometryOperation.cs @@ -1,34 +1,32 @@ //----------------------------------------------------------------------- -//----------------------------------------------------------------------- -// file="GeometryOperation.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. +// ----------------------------------------------------------------------- +// file="GeometryOperation" +// Project: StgSharp +// AuthorGroup: Nitload Space +// Copyright (c) Nitload Space. All rights reserved. // -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -//----------------------------------------------------------------------- -//----------------------------------------------------------------------- +// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- using StgSharp.Mathematics; +using StgSharp.Mathematics.Graphic; using System.Runtime.CompilerServices; @@ -37,10 +35,10 @@ namespace StgSharp.Geometries public static unsafe class GeometryOperation { - [MethodImpl( MethodImplOptions.AggressiveInlining )] - public static Vec3 DefaultMotion( int tick ) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static Vec3 DefaultMotion(int tick) { - return default( Vec3 ); + return default(Vec3); } } diff --git a/StgSharp.Common/Geometries/PlainGeometry/Define/IPlainEntity.cs b/StgSharp.Common/Geometries/PlainGeometry/Define/IPlainEntity.cs index 01ee7bd8..f5c2effa 100644 --- a/StgSharp.Common/Geometries/PlainGeometry/Define/IPlainEntity.cs +++ b/StgSharp.Common/Geometries/PlainGeometry/Define/IPlainEntity.cs @@ -1,34 +1,35 @@ //----------------------------------------------------------------------- -//----------------------------------------------------------------------- -// file="IPlainEntity.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. +// ----------------------------------------------------------------------- +// file="IPlainEntity.cs" +// Project: StgSharp +// AuthorGroup: Nitload Space +// Copyright (c) Nitload Space. All rights reserved. // -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the “Software”), to deal in the Software without restriction, +// including without limitation the rights to use, copy, modify, merge, +// publish, distribute, sublicense, and/or sell copies of the Software, +// and to permit persons to whom the Software is furnished to do so, +// subject to the following conditions: // -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. +// The above copyright notice and +// this permission notice shall be included in all copies +// or substantial portions of the Software. // -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// THE SOFTWARE IS PROVIDED “AS IS”, +// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH +// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -//----------------------------------------------------------------------- -//----------------------------------------------------------------------- +// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- using StgSharp.Mathematics; +using StgSharp.Mathematics.Graphic; using System; using System.Collections.Generic; @@ -43,7 +44,7 @@ namespace StgSharp.Geometries public Vec2 CenterPosition { get; set; } - public bool CollideWith( IPlainEntity entity ); + public bool CollideWith(IPlainEntity entity); } @@ -52,12 +53,12 @@ namespace StgSharp.Geometries private PlainGeometry _shape; - public PlainEntity( PlainGeometry shape ) + public PlainEntity(PlainGeometry shape) { _shape = shape; } - bool IPlainEntity.CollideWith( IPlainEntity entity ) + bool IPlainEntity.CollideWith(IPlainEntity entity) { throw new NotImplementedException(); } diff --git a/StgSharp.Common/Geometries/PlainGeometry/Define/ParticleOnPlain.cs b/StgSharp.Common/Geometries/PlainGeometry/Define/ParticleOnPlain.cs index eacecd2e..82afe920 100644 --- a/StgSharp.Common/Geometries/PlainGeometry/Define/ParticleOnPlain.cs +++ b/StgSharp.Common/Geometries/PlainGeometry/Define/ParticleOnPlain.cs @@ -1,34 +1,32 @@ //----------------------------------------------------------------------- -//----------------------------------------------------------------------- -// file="ParticleOnPlain.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. +// ----------------------------------------------------------------------- +// file="ParticleOnPlain" +// Project: StgSharp +// AuthorGroup: Nitload Space +// Copyright (c) Nitload Space. All rights reserved. // -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -//----------------------------------------------------------------------- -//----------------------------------------------------------------------- +// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- using StgSharp.Mathematics; +using StgSharp.Mathematics.Graphic; using System; using System.Collections.Generic; @@ -43,14 +41,14 @@ namespace StgSharp.Geometries public class ParticleOnPlain : IInstancing, IPlainEntity { - public ParticleOnPlain( PlainInstancingBuffer buffer ) + public ParticleOnPlain(PlainInstancingBuffer buffer) { - if( buffer == null ) { - throw new ArgumentNullException( paramName: nameof( buffer ) ); + if (buffer == null) { + throw new ArgumentNullException(paramName:nameof(buffer)); } GlobalBuffer = buffer; BufferId = buffer.CreateInstanceID(); - ( ( IInstancingBuffer )buffer ).InstanceList.Add( this ); + ((IInstancingBuffer)buffer).InstanceList.Add(this); } public GeometryMotion Motion { get; set; } @@ -61,14 +59,14 @@ namespace StgSharp.Geometries Vec3 IInstancing.CenterPositionGlobal { get; set; } - bool IPlainEntity.CollideWith( IPlainEntity entity ) + bool IPlainEntity.CollideWith(IPlainEntity entity) { throw new NotImplementedException(); } Vec2 IPlainEntity.CenterPosition { - get => GlobalBuffer.CoordAndRotationList[ BufferId ].XY; + get => GlobalBuffer.CoordAndRotationList[BufferId].XY; set => throw new NotImplementedException(); } diff --git a/StgSharp.Common/Geometries/PlainGeometry/Define/PlainGeometry.cs b/StgSharp.Common/Geometries/PlainGeometry/Define/PlainGeometry.cs index 41c49a12..de6720de 100644 --- a/StgSharp.Common/Geometries/PlainGeometry/Define/PlainGeometry.cs +++ b/StgSharp.Common/Geometries/PlainGeometry/Define/PlainGeometry.cs @@ -1,35 +1,33 @@ //----------------------------------------------------------------------- -//----------------------------------------------------------------------- -// file="PlainGeometry.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. +// ----------------------------------------------------------------------- +// file="PlainGeometry" +// Project: StgSharp +// AuthorGroup: Nitload Space +// Copyright (c) Nitload Space. All rights reserved. // -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -//----------------------------------------------------------------------- -//----------------------------------------------------------------------- +// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- using StgSharp.Graphics; using StgSharp.Mathematics; +using StgSharp.Mathematics.Graphic; using System; using System.ComponentModel; @@ -45,15 +43,15 @@ namespace StgSharp.Geometries protected Vec4[] vertexMat; internal CoordinationBase coordinate; - internal PlainGeometry( CoordinationBase coordination ) + internal PlainGeometry(CoordinationBase coordination) { coordinate = coordination; } - public Point this[ int index ] + public Point this[int index] { - get => new Point( vertexMat[ index ] ); - set => vertexMat[ index ].vec = value.coordVec; + get => new Point(vertexMat[index]); + set => vertexMat[index].vec = value.coordVec; } public int VertexCount => this.vertexMat.Length; diff --git a/StgSharp.Common/Geometries/PlainGeometry/Define/PlainInstancingBuffer.cs b/StgSharp.Common/Geometries/PlainGeometry/Define/PlainInstancingBuffer.cs index 5c9c3815..29702a1f 100644 --- a/StgSharp.Common/Geometries/PlainGeometry/Define/PlainInstancingBuffer.cs +++ b/StgSharp.Common/Geometries/PlainGeometry/Define/PlainInstancingBuffer.cs @@ -1,34 +1,33 @@ //----------------------------------------------------------------------- -//----------------------------------------------------------------------- -// file="PlainInstancingBuffer.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. +// ----------------------------------------------------------------------- +// file="PlainInstancingBuffer" +// Project: StgSharp +// AuthorGroup: Nitload Space +// Copyright (c) Nitload Space. All rights reserved. // -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -//----------------------------------------------------------------------- -//----------------------------------------------------------------------- +// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- using StgSharp.Mathematics; +using StgSharp.Mathematics.Graphic; +using StgSharp.Mathematics.Numeric; using System; using System.Collections; @@ -38,19 +37,20 @@ using System.Diagnostics.Contracts; using System.Linq; using System.Numerics; using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; using System.Text; using System.Threading; using System.Threading.Tasks; namespace StgSharp.Geometries { - public class PlainInstancingBuffer : IDisposable, IEnumerable, IInstancingBuffer - where T: IInstancing + public class PlainInstancingBuffer : IDisposable, IEnumerable, IInstancingBuffer where T: IInstancing { private bool disposedValue; - private CoordinatePlain globalCorrdinnate; + private CoordinatePlain globalCoordinate; private List coordList; private List instanceList; private List scalingList; @@ -58,9 +58,9 @@ namespace StgSharp.Geometries public PlainInstancingBuffer() { - coordList = new List( capacity: 100 ); - instanceList = new List( capacity: 100 ); - scalingList = new List( capacity: 100 ); + coordList = new List(capacity:100); + instanceList = new List(capacity:100); + scalingList = new List(capacity:100); coordArray = Array.Empty(); scaleArray = Array.Empty(); mutex = new Mutex(); @@ -68,125 +68,96 @@ namespace StgSharp.Geometries public List InstanceList { + [MethodImpl(MethodImplOptions.AggressiveInlining)] get => instanceList; } public List CoordAndRotationList { + [MethodImpl(MethodImplOptions.AggressiveInlining)] get => coordList; } public List ScalingList { + [MethodImpl(MethodImplOptions.AggressiveInlining)] get => scalingList; } public Span CoordAndRotationSpan { - get - { - if( coordArray.Length != coordList.Capacity ) - { - FieldInfo fieldInfo = typeof( List ). - GetField( "_items", BindingFlags.NonPublic | BindingFlags.Instance ); - if( fieldInfo == null ) - { - #pragma warning disable CA1065 - #pragma warning disable CA2201 - throw new NullReferenceException(); - #pragma warning restore CA2201 - #pragma warning restore CA1065 - } - coordArray = ( Vec4[] )fieldInfo.GetValue( coordList ); - } - return new Span( coordArray, 0, coordList.Count ); - } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get => CollectionsMarshal.AsSpan(coordList); } public Span ScalingSpan { - get - { - if( scaleArray.Length != coordList.Capacity ) - { - FieldInfo fieldInfo = typeof( List ). - GetField( "_items", BindingFlags.NonPublic | BindingFlags.Instance ); - if( fieldInfo == null ) - { - #pragma warning disable CA1065 - #pragma warning disable CA2201 - throw new NullReferenceException(); - #pragma warning restore CA2201 - #pragma warning restore CA1065 - } - scaleArray = ( float[] )fieldInfo.GetValue( scalingList ); - } - return new Span( scaleArray, 0, coordList.Count ); - } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get => CollectionsMarshal.AsSpan(scalingList); } public int CreateInstanceID() { mutex.WaitOne(); int ret = instanceList.Count; - coordList.Add( new Vec4() ); - scalingList.Add( 0 ); + coordList.Add(new Vec4()); + scalingList.Add(0); mutex.ReleaseMutex(); return ret; } // ~PlainInstancingBuffer() // { - // Dispose(disposing: false); + // Dispose(disposing: false); // } public void Dispose() { - Dispose( disposing: true ); - GC.SuppressFinalize( this ); + Dispose(disposing:true); + GC.SuppressFinalize(this); } public IEnumerator GetEnumerator() { - foreach( IInstancing item in instanceList ) { - yield return ( T )item; + foreach (IInstancing item in instanceList) { + yield return (T)item; } } - public void Remove( T instance ) + public void Remove(T instance) { mutex.WaitOne(); - if( instance.GlobalBuffer != this ) { + if (instance.GlobalBuffer != this) { throw new ArgumentException( - message: "instance does not belong to current Particle Buffer", - paramName: nameof( instance ) ); + message:"instance does not belong to current Particle Buffer", + paramName:nameof(instance)); } int index = instance.BufferId; - IInstancing temp = instanceList[ instanceList.Count - 1 ]; - instanceList[ instance.BufferId ] = temp; + IInstancing temp = instanceList[^1]; + instanceList[instance.BufferId] = temp; temp.BufferId = instance.BufferId; - coordList[ instance.BufferId ] = coordList[ coordList.Count - 1 ]; - scalingList[ instance.BufferId ] = scalingList[ scalingList.Count - 1 ]; + coordList[instance.BufferId] = coordList[^1]; + scalingList[instance.BufferId] = scalingList[^1]; - instanceList.RemoveAt( instanceList.Count - 1 ); - coordList.RemoveAt( coordList.Count - 1 ); - scalingList.RemoveAt( scalingList.Count - 1 ); + instanceList.RemoveAt(instanceList.Count - 1); + coordList.RemoveAt(coordList.Count - 1); + scalingList.RemoveAt(scalingList.Count - 1); mutex.ReleaseMutex(); } public void UpdateAllParticles() { - foreach( IInstancing particle in instanceList ) { + foreach (IInstancing particle in instanceList) { particle.Move(); } } - protected virtual void Dispose( bool disposing ) + protected virtual void Dispose(bool disposing) { - if( !disposedValue ) + if (!disposedValue) { - if( disposing ) { + if (disposing) { mutex.Dispose(); } @@ -199,8 +170,8 @@ namespace StgSharp.Geometries IEnumerator IEnumerable.GetEnumerator() { - foreach( IInstancing item in instanceList ) { - yield return ( T )item; + foreach (IInstancing item in instanceList) { + yield return (T)item; } } diff --git a/StgSharp.Common/Geometries/PlainGeometry/Parallelogram.cs b/StgSharp.Common/Geometries/PlainGeometry/Parallelogram.cs index 49e3e4af..f1e5bcc6 100644 --- a/StgSharp.Common/Geometries/PlainGeometry/Parallelogram.cs +++ b/StgSharp.Common/Geometries/PlainGeometry/Parallelogram.cs @@ -1,34 +1,32 @@ //----------------------------------------------------------------------- -//----------------------------------------------------------------------- -// file="Parallelogram.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. +// ----------------------------------------------------------------------- +// file="Parallelogram" +// Project: StgSharp +// AuthorGroup: Nitload Space +// Copyright (c) Nitload Space. All rights reserved. // -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -//----------------------------------------------------------------------- -//----------------------------------------------------------------------- +// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- using StgSharp.Mathematics; +using StgSharp.Mathematics.Graphic; using System; @@ -38,22 +36,14 @@ namespace StgSharp.Geometries { internal readonly Func movCenterOperation = - new Func( GeometryOperation.DefaultMotion ); + new Func(GeometryOperation.DefaultMotion); internal Point center; - public Parallelogram( - float v0x, - float v0y, - float v1x, - float v1y, - float v2x, - float v2y, - float v3x, - float v3y ) - : base( v0x, v0y, v1x, v1y, v2x, v2y, v3x, v3y ) + public Parallelogram(float v0x, float v0y, float v1x, float v1y, float v2x, float v2y, float v3x, float v3y) + : base(v0x, v0y, v1x, v1y, v2x, v2y, v3x, v3y) { - #if DEBUG + #if DEBUG if( this[ 0 ].Coord + this[ 2 ].Coord != this[ 1 ].Coord + this[ 3 ].Coord ) { InternalIO.InternalWriteLog( @@ -72,10 +62,10 @@ namespace StgSharp.Geometries float v2x, float v2y, float v3x, - float v3y ) - : base( coordination, v0x, v0y, v1x, v1y, v2x, v2y, v3x, v3y ) + float v3y) + : base(coordination, v0x, v0y, v1x, v1y, v2x, v2y, v3x, v3y) { - #if DEBUG + #if DEBUG if( this[ 0 ].Coord + this[ 2 ].Coord != this[ 1 ].Coord + this[ 3 ].Coord ) { InternalIO.InternalWriteLog( diff --git a/StgSharp.Common/Geometries/PlainGeometry/Plain.cs b/StgSharp.Common/Geometries/PlainGeometry/Plain.cs index b6d0f4ad..5f85cc4e 100644 --- a/StgSharp.Common/Geometries/PlainGeometry/Plain.cs +++ b/StgSharp.Common/Geometries/PlainGeometry/Plain.cs @@ -1,34 +1,32 @@ //----------------------------------------------------------------------- -//----------------------------------------------------------------------- -// file="Plain.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. +// ----------------------------------------------------------------------- +// file="Plain" +// Project: StgSharp +// AuthorGroup: Nitload Space +// Copyright (c) Nitload Space. All rights reserved. // -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -//----------------------------------------------------------------------- -//----------------------------------------------------------------------- +// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- using StgSharp.Mathematics; +using StgSharp.Mathematics.Graphic; using System.Numerics; @@ -44,40 +42,40 @@ namespace StgSharp.Geometries internal Vec3 vec1; internal Vec3 vec2; - public Plain( Vec3 o, Vec3 v1, Vec3 v2 ) + public Plain(Vec3 o, Vec3 v1, Vec3 v2) { this._origin = o; - this.vec1 = v1 - ( v2 * ( v1.Y / v2.Y ) ); //xz - this.vec2 = v2 - ( vec1 * ( v2.X / v1.X ) ); //yz + this.vec1 = v1 - (v2 * (v1.Y / v2.Y)); //xz + this.vec2 = v2 - (vec1 * (v2.X / v1.X)); //yz - //|_origin|-k1*|vec1|-k2*|vec2| --> plainParameter.Z; - plainParameter.Z = _origin.Z - ( vec1.Z * ( _origin.X / vec1.X ) ) - ( vec2.Z * ( _origin.Y / vec2.Y ) ); + // |_origin|-k1*|vec1|-k2*|vec2| --> plainParameter.Z; + plainParameter.Z = _origin.Z - (vec1.Z * (_origin.X / vec1.X)) - (vec2.Z * (_origin.Y / vec2.Y)); - //plainParameter.Z -> plainParameter.X, plainParameter.Y - plainParameter.X = vec1.X * ( vec1.Z / plainParameter.Z ); - plainParameter.Y = vec2.Y * ( vec2.Z / plainParameter.Z ); + // plainParameter.Z -> plainParameter.X, plainParameter.Y + plainParameter.X = vec1.X * (vec1.Z / plainParameter.Z); + plainParameter.Y = vec2.Y * (vec2.Z / plainParameter.Z); plainParameter.X = 1 / plainParameter.X; plainParameter.Y = 1 / plainParameter.Y; plainParameter.Z = 1 / plainParameter.Z; } - public Plain( Point p1, Point p2, Point p3 ) + public Plain(Point p1, Point p2, Point p3) { Vec3 origin = p1.Coord; Vec3 v1 = p2.Coord - origin; Vec3 v2 = p3.Coord - origin; - vec1 = v1 - ( v2 * ( v1.Y / v2.Y ) ); //xz - vec2 = v2 - ( vec1 * ( v2.X / v1.X ) ); //yz + vec1 = v1 - (v2 * (v1.Y / v2.Y)); //xz + vec2 = v2 - (vec1 * (v2.X / v1.X)); //yz - //|_origin|-k1*|vec1|-k2*|vec2| --> plainParameter.Z; - plainParameter.Z = origin.Z - ( vec1.Z * ( origin.X / vec1.X ) ) - ( vec2.Z * ( origin.Y / vec2.Y ) ); + // |_origin|-k1*|vec1|-k2*|vec2| --> plainParameter.Z; + plainParameter.Z = origin.Z - (vec1.Z * (origin.X / vec1.X)) - (vec2.Z * (origin.Y / vec2.Y)); - //plainParameter.Z --> plainParameter.X, plainParameter.Y - plainParameter.X = vec1.X * ( vec1.Z / plainParameter.Z ); - plainParameter.Y = vec2.Y * ( vec2.Z / plainParameter.Z ); + // plainParameter.Z --> plainParameter.X, plainParameter.Y + plainParameter.X = vec1.X * (vec1.Z / plainParameter.Z); + plainParameter.Y = vec2.Y * (vec2.Z / plainParameter.Z); plainParameter.X = 1 / plainParameter.X; plainParameter.Y = 1 / plainParameter.Y; diff --git a/StgSharp.Common/Geometries/PlainGeometry/Polygon4.cs b/StgSharp.Common/Geometries/PlainGeometry/Polygon4.cs index 170eec86..fa3d2da6 100644 --- a/StgSharp.Common/Geometries/PlainGeometry/Polygon4.cs +++ b/StgSharp.Common/Geometries/PlainGeometry/Polygon4.cs @@ -1,34 +1,32 @@ //----------------------------------------------------------------------- -//----------------------------------------------------------------------- -// file="Polygon4.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. +// ----------------------------------------------------------------------- +// file="Polygon4" +// Project: StgSharp +// AuthorGroup: Nitload Space +// Copyright (c) Nitload Space. All rights reserved. // -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -//----------------------------------------------------------------------- -//----------------------------------------------------------------------- +// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- using StgSharp.Mathematics; +using StgSharp.Mathematics.Graphic; using System; using System.Numerics; @@ -38,30 +36,30 @@ namespace StgSharp.Geometries public class Polygon4 : PlainGeometry { - protected static int[] Indices = [0, 1, 2, 0, 2, 3]; + protected static int[] Indices = [ 0, 1, 2, 0, 2, 3 ]; internal Polygon4() - : base( PlainCoordinate.StandardPlainCoordination ) + : base(PlainCoordinate.StandardPlainCoordination) { vertexMat = new Vec4[4]; } - internal Polygon4( Vec4[] rawCoord ) - : base( PlainCoordinate.StandardPlainCoordination ) + internal Polygon4(Vec4[] rawCoord) + : base(PlainCoordinate.StandardPlainCoordination) { - if( rawCoord.Length != 4 ) { - throw new ArgumentOutOfRangeException( nameof( rawCoord ) ); + if (rawCoord.Length != 4) { + throw new ArgumentOutOfRangeException(nameof(rawCoord)); } vertexMat = rawCoord; } - public Polygon4( Point topLeft, Point topRight, Point bottomRight, Point bottomLeft ) - : base( PlainCoordinate.StandardPlainCoordination ) + public Polygon4(Point topLeft, Point topRight, Point bottomRight, Point bottomLeft) + : base(PlainCoordinate.StandardPlainCoordination) { - this[ 0 ] = topLeft; - this[ 1 ] = topRight; - this[ 2 ] = bottomRight; - this[ 3 ] = bottomLeft; + this[0] = topLeft; + this[1] = topRight; + this[2] = bottomRight; + this[3] = bottomLeft; } public Polygon4( @@ -70,32 +68,24 @@ namespace StgSharp.Geometries Point topLeft, Point topRight, Point bottomRight, - Point bottomLeft ) - : base( coordinate ) + Point bottomLeft) + : base(coordinate) { - this[ 0 ] = topLeft; - this[ 1 ] = topRight; - this[ 2 ] = bottomRight; - this[ 3 ] = bottomLeft; + this[0] = topLeft; + this[1] = topRight; + this[2] = bottomRight; + this[3] = bottomLeft; } - public Polygon4( - float v0x, - float v0y, - float v1x, - float v1y, - float v2x, - float v2y, - float v3x, - float v3y ) - : base( PlainCoordinate.StandardPlainCoordination ) + public Polygon4(float v0x, float v0y, float v1x, float v1y, float v2x, float v2y, float v3x, float v3y) + : base(PlainCoordinate.StandardPlainCoordination) { vertexMat = new Vec4[4]; - this[ 0 ] = new Point( v0x, v0y, 0 ); - this[ 1 ] = new Point( v1x, v1y, 0 ); - this[ 2 ] = new Point( v2x, v2y, 0 ); - this[ 3 ] = new Point( v3x, v3y, 0 ); + this[0] = new Point(v0x, v0y, 0); + this[1] = new Point(v1x, v1y, 0); + this[2] = new Point(v2x, v2y, 0); + this[3] = new Point(v3x, v3y, 0); } public Polygon4( @@ -107,15 +97,15 @@ namespace StgSharp.Geometries float v2x, float v2y, float v3x, - float v3y ) - : base( coordination ) + float v3y) + : base(coordination) { vertexMat = new Vec4[4]; - this[ 0 ] = new Point( v0x, v0y, 0 ); - this[ 1 ] = new Point( v1x, v1y, 0 ); - this[ 2 ] = new Point( v2x, v2y, 0 ); - this[ 3 ] = new Point( v3x, v3y, 0 ); + this[0] = new Point(v0x, v0y, 0); + this[1] = new Point(v1x, v1y, 0); + this[2] = new Point(v2x, v2y, 0); + this[3] = new Point(v3x, v3y, 0); } public override ReadOnlySpan VertexIndices => Indices; diff --git a/StgSharp.Common/Geometries/PlainGeometry/Polygon5.cs b/StgSharp.Common/Geometries/PlainGeometry/Polygon5.cs index 5c846ece..2aaecbe7 100644 --- a/StgSharp.Common/Geometries/PlainGeometry/Polygon5.cs +++ b/StgSharp.Common/Geometries/PlainGeometry/Polygon5.cs @@ -1,34 +1,32 @@ //----------------------------------------------------------------------- -//----------------------------------------------------------------------- -// file="Polygon5.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. +// ----------------------------------------------------------------------- +// file="Polygon5" +// Project: StgSharp +// AuthorGroup: Nitload Space +// Copyright (c) Nitload Space. All rights reserved. // -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -//----------------------------------------------------------------------- -//----------------------------------------------------------------------- +// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- using StgSharp.Mathematics; +using StgSharp.Mathematics.Graphic; using System; using System.Numerics; @@ -38,10 +36,10 @@ namespace StgSharp.Geometries public unsafe class Polygon5 : PlainGeometry { - internal static int[] Indices = [0, 1, 2, 0, 2, 3, 0, 3, 4]; + internal static int[] Indices = [ 0, 1, 2, 0, 2, 3, 0, 3, 4 ]; public unsafe Polygon5() - : base( PlainCoordinate.StandardPlainCoordination ) + : base(PlainCoordinate.StandardPlainCoordination) { vertexMat = new Vec4[5]; } @@ -56,15 +54,15 @@ namespace StgSharp.Geometries float v3x, float v3y, float v4x, - float v4y ) - : base( PlainCoordinate.StandardPlainCoordination ) + float v4y) + : base(PlainCoordinate.StandardPlainCoordination) { vertexMat = new Vec4[5]; - this[ 0 ] = new Point( v0x, v0y, 0 ); - this[ 1 ] = new Point( v1x, v1y, 0 ); - this[ 2 ] = new Point( v2x, v2y, 0 ); - this[ 3 ] = new Point( v3x, v3y, 0 ); - this[ 4 ] = new Point( v4x, v4y, 0 ); + this[0] = new Point(v0x, v0y, 0); + this[1] = new Point(v1x, v1y, 0); + this[2] = new Point(v2x, v2y, 0); + this[3] = new Point(v3x, v3y, 0); + this[4] = new Point(v4x, v4y, 0); } public Polygon5( @@ -78,15 +76,15 @@ namespace StgSharp.Geometries float v3x, float v3y, float v4x, - float v4y ) - : base( coordination ) + float v4y) + : base(coordination) { vertexMat = new Vec4[5]; - this[ 0 ] = new Point( v0x, v0y, 0 ); - this[ 1 ] = new Point( v1x, v1y, 0 ); - this[ 2 ] = new Point( v2x, v2y, 0 ); - this[ 3 ] = new Point( v3x, v3y, 0 ); - this[ 4 ] = new Point( v4x, v4y, 0 ); + this[0] = new Point(v0x, v0y, 0); + this[1] = new Point(v1x, v1y, 0); + this[2] = new Point(v2x, v2y, 0); + this[3] = new Point(v3x, v3y, 0); + this[4] = new Point(v4x, v4y, 0); } public override ReadOnlySpan VertexIndices => Indices; diff --git a/StgSharp.Common/Geometries/PlainGeometry/Polygon6.cs b/StgSharp.Common/Geometries/PlainGeometry/Polygon6.cs index e7d663ea..f33d5c34 100644 --- a/StgSharp.Common/Geometries/PlainGeometry/Polygon6.cs +++ b/StgSharp.Common/Geometries/PlainGeometry/Polygon6.cs @@ -1,34 +1,32 @@ //----------------------------------------------------------------------- // ----------------------------------------------------------------------- -// file="Polygon6.cs" +// file="Polygon6" // Project: StgSharp // AuthorGroup: Nitload Space // Copyright (c) Nitload Space. All rights reserved. // -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // // ----------------------------------------------------------------------- // ----------------------------------------------------------------------- using StgSharp.Mathematics; +using StgSharp.Mathematics.Graphic; using System; using System.Numerics; @@ -38,7 +36,7 @@ namespace StgSharp.Geometries public class Polygon6 : PlainGeometry { - internal static int[] Indices = [0, 1, 2, 0, 2, 3, 0, 3, 4, 0, 4, 5]; + internal static int[] Indices = [ 0, 1, 2, 0, 2, 3, 0, 3, 4, 0, 4, 5 ]; public Polygon6() : base(PlainCoordinate.StandardPlainCoordination) diff --git a/StgSharp.Common/Geometries/PlainGeometry/Rectangle.cs b/StgSharp.Common/Geometries/PlainGeometry/Rectangle.cs index edd803e2..19119162 100644 --- a/StgSharp.Common/Geometries/PlainGeometry/Rectangle.cs +++ b/StgSharp.Common/Geometries/PlainGeometry/Rectangle.cs @@ -1,34 +1,35 @@ //----------------------------------------------------------------------- -//----------------------------------------------------------------------- -// file="Rectangle.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. +// ----------------------------------------------------------------------- +// file="Rectangle.cs" +// Project: StgSharp +// AuthorGroup: Nitload Space +// Copyright (c) Nitload Space. All rights reserved. // -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the “Software”), to deal in the Software without restriction, +// including without limitation the rights to use, copy, modify, merge, +// publish, distribute, sublicense, and/or sell copies of the Software, +// and to permit persons to whom the Software is furnished to do so, +// subject to the following conditions: // -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. +// The above copyright notice and +// this permission notice shall be included in all copies +// or substantial portions of the Software. // -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// THE SOFTWARE IS PROVIDED “AS IS”, +// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH +// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -//----------------------------------------------------------------------- -//----------------------------------------------------------------------- +// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- using StgSharp.Mathematics; +using StgSharp.Mathematics.Graphic; using System; using System.Numerics; @@ -38,18 +39,10 @@ namespace StgSharp.Geometries public class Rectangle : Parallelogram { - public Rectangle( - float v0x, - float v0y, - float v1x, - float v1y, - float v2x, - float v2y, - float v3x, - float v3y ) - : base( v0x, v0y, v1x, v1y, v2x, v2y, v3x, v3y ) + public Rectangle(float v0x, float v0y, float v1x, float v1y, float v2x, float v2y, float v3x, float v3y) + : base(v0x, v0y, v1x, v1y, v2x, v2y, v3x, v3y) { - #if DEBUG + #if DEBUG Vec2 side0 = ( this[ 0 ].Coord - this[ 1 ].Coord ).XY; Vec2 side1 = ( this[ 2 ].Coord - this[ 1 ].Coord ).XY; if( side0.Cross( side1 ) == 0 ) { @@ -67,10 +60,10 @@ namespace StgSharp.Geometries float v2x, float v2y, float v3x, - float v3y ) - : base( coordination, v0x, v0y, v1x, v1y, v2x, v2y, v3x, v3y ) + float v3y) + : base(coordination, v0x, v0y, v1x, v1y, v2x, v2y, v3x, v3y) { - #if DEBUG + #if DEBUG Vec2 side0 = ( this[ 0 ].Coord - this[ 1 ].Coord ).XY; Vec2 side1 = ( this[ 2 ].Coord - this[ 1 ].Coord ).XY; if( side0.Cross( side1 ) == 0 ) { @@ -88,9 +81,9 @@ namespace StgSharp.Geometries /// /// /// - public virtual Vec3 MovCenter( uint tick ) + public virtual Vec3 MovCenter(uint tick) { - return default( Vec3 ); + return default(Vec3); } } diff --git a/StgSharp.Common/Geometries/PlainGeometry/Triangle.cs b/StgSharp.Common/Geometries/PlainGeometry/Triangle.cs index 98789490..b7d97da1 100644 --- a/StgSharp.Common/Geometries/PlainGeometry/Triangle.cs +++ b/StgSharp.Common/Geometries/PlainGeometry/Triangle.cs @@ -1,35 +1,36 @@ //----------------------------------------------------------------------- -//----------------------------------------------------------------------- -// file="Triangle.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. +// ----------------------------------------------------------------------- +// file="Triangle.cs" +// Project: StgSharp +// AuthorGroup: Nitload Space +// Copyright (c) Nitload Space. All rights reserved. // -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the “Software”), to deal in the Software without restriction, +// including without limitation the rights to use, copy, modify, merge, +// publish, distribute, sublicense, and/or sell copies of the Software, +// and to permit persons to whom the Software is furnished to do so, +// subject to the following conditions: // -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. +// The above copyright notice and +// this permission notice shall be included in all copies +// or substantial portions of the Software. // -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// THE SOFTWARE IS PROVIDED “AS IS”, +// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH +// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -//----------------------------------------------------------------------- -//----------------------------------------------------------------------- +// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- using StgSharp.Graphics; using StgSharp.Mathematics; +using StgSharp.Mathematics.Graphic; using System; using System.Numerics; @@ -39,55 +40,44 @@ namespace StgSharp.Geometries public unsafe class Triangle : PlainGeometry { - internal static int[] Indices = [0, 1, 2]; + internal static int[] Indices = [ 0, 1, 2 ]; public Triangle() - : base( PlainCoordinate.StandardPlainCoordination ) + : base(PlainCoordinate.StandardPlainCoordination) { vertexMat = new Vec4[3]; } - public Triangle( Point vertex01, Point vertex02, Point vertex03 ) - : base( PlainCoordinate.StandardPlainCoordination ) + public Triangle(Point vertex01, Point vertex02, Point vertex03) + : base(PlainCoordinate.StandardPlainCoordination) { - this[ 0 ] = vertex01; - this[ 1 ] = vertex02; - this[ 2 ] = vertex03; + this[0] = vertex01; + this[1] = vertex02; + this[2] = vertex03; } - public Triangle( - PlainCoordinate coordination, - Point vertex01, - Point vertex02, - Point vertex03 ) - : base( coordination ) + public Triangle(PlainCoordinate coordination, Point vertex01, Point vertex02, Point vertex03) + : base(coordination) { - this[ 0 ] = vertex01; - this[ 1 ] = vertex02; - this[ 2 ] = vertex03; + this[0] = vertex01; + this[1] = vertex02; + this[2] = vertex03; } - public Triangle( float v0x, float v0y, float v1x, float v1y, float v2x, float v2y ) - : base( PlainCoordinate.StandardPlainCoordination ) + public Triangle(float v0x, float v0y, float v1x, float v1y, float v2x, float v2y) + : base(PlainCoordinate.StandardPlainCoordination) { - this[ 0 ] = new Point( v0x, v0y, 0 ); - this[ 1 ] = new Point( v1x, v1y, 0 ); - this[ 2 ] = new Point( v2x, v2y, 0 ); + this[0] = new Point(v0x, v0y, 0); + this[1] = new Point(v1x, v1y, 0); + this[2] = new Point(v2x, v2y, 0); } - public Triangle( - PlainCoordinate coordination, - float v0x, - float v0y, - float v1x, - float v1y, - float v2x, - float v2y ) - : base( coordination ) + public Triangle(PlainCoordinate coordination, float v0x, float v0y, float v1x, float v1y, float v2x, float v2y) + : base(coordination) { - this[ 0 ] = new Point( v0x, v0y, 0 ); - this[ 1 ] = new Point( v1x, v1y, 0 ); - this[ 2 ] = new Point( v2x, v2y, 0 ); + this[0] = new Point(v0x, v0y, 0); + this[1] = new Point(v1x, v1y, 0); + this[2] = new Point(v2x, v2y, 0); } public override ReadOnlySpan VertexIndices => Indices; diff --git a/StgSharp.Common/Geometries/Point.cs b/StgSharp.Common/Geometries/Point.cs index c5735d06..75366f4d 100644 --- a/StgSharp.Common/Geometries/Point.cs +++ b/StgSharp.Common/Geometries/Point.cs @@ -1,34 +1,32 @@ //----------------------------------------------------------------------- // ----------------------------------------------------------------------- -// file="Point.cs" +// file="Point" // Project: StgSharp // AuthorGroup: Nitload Space // Copyright (c) Nitload Space. All rights reserved. // -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // // ----------------------------------------------------------------------- // ----------------------------------------------------------------------- using StgSharp.Mathematics; +using StgSharp.Mathematics.Graphic; using System; using System.Collections.Generic; diff --git a/StgSharp.Common/Geometries/SpaceGeometry/TriangulatedSurface.cs b/StgSharp.Common/Geometries/SpaceGeometry/TriangulatedSurface.cs index cef79f9f..2e903c8c 100644 --- a/StgSharp.Common/Geometries/SpaceGeometry/TriangulatedSurface.cs +++ b/StgSharp.Common/Geometries/SpaceGeometry/TriangulatedSurface.cs @@ -1,40 +1,38 @@ //----------------------------------------------------------------------- // ----------------------------------------------------------------------- -// file="TriangulatedSurface.cs" +// file="TriangulatedSurface" // Project: StgSharp // AuthorGroup: Nitload Space // Copyright (c) Nitload Space. All rights reserved. // -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // // ----------------------------------------------------------------------- // ----------------------------------------------------------------------- using StgSharp.HighPerformance; using StgSharp.Mathematics; -using StgSharp.Mathematics.HighPrecision; +using StgSharp.Mathematics.Graphic; using System; using System.Collections.Generic; using System.Linq; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; using System.Text; @@ -61,6 +59,7 @@ namespace StgSharp.Geometries /**/ public IEnumerable> SideIndicesEnumeratble { + [MethodImpl(MethodImplOptions.AggressiveInlining)] get => _sideIndices ; } @@ -78,11 +77,13 @@ namespace StgSharp.Geometries public Span VertexSpan { + [MethodImpl(MethodImplOptions.AggressiveInlining)] get => CollectionsMarshal.AsSpan(_vertices); } public Span TriangleIndicesSpan { + [MethodImpl(MethodImplOptions.AggressiveInlining)] get => CollectionsMarshal.AsSpan(_triangleIndices); } @@ -93,13 +94,13 @@ namespace StgSharp.Geometries _triangleIndices.Add(v2); _triangleIndices.Add(v3); if (!(_sides.Remove((v1,v2)) || _sides.Remove((v2, v1)))) { - _sides.Add((v1, v2)); + _ = _sides.Add((v1, v2)); } if (!(_sides.Remove((v2, v3)) || _sides.Remove((v3, v2)))) { - _sides.Add((v2, v3)); + _ = _sides.Add((v2, v3)); } if (!(_sides.Remove((v3, v1)) || _sides.Remove((v1, v3)))) { - _sides.Add((v3, v1)); + _ = _sides.Add((v3, v1)); } } @@ -119,7 +120,7 @@ namespace StgSharp.Geometries _vertices.TrimExcess(); Dictionary side_dictionary = _sides.ToDictionary(x => x.begin, x => x.end); int begin = side_dictionary.First().Key; - List sideLoop = new List(begin); + List sideLoop = new(begin); _sideIndices.Add(sideLoop); while (side_dictionary.Count > 0) { diff --git a/StgSharp.Common/Graphics/OpenGL/Buffer/VBO.cs b/StgSharp.Common/Graphics/OpenGL/Buffer/VBO.cs index 7b0e53c9..77305a3e 100644 --- a/StgSharp.Common/Graphics/OpenGL/Buffer/VBO.cs +++ b/StgSharp.Common/Graphics/OpenGL/Buffer/VBO.cs @@ -1,34 +1,32 @@ //----------------------------------------------------------------------- // ----------------------------------------------------------------------- -// file="VBO.cs" +// file="VBO" // Project: StgSharp // AuthorGroup: Nitload Space // Copyright (c) Nitload Space. All rights reserved. // -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // // ----------------------------------------------------------------------- // ----------------------------------------------------------------------- using StgSharp.Mathematics; +using StgSharp.Mathematics.Numeric; using System; using System.Collections.Generic; @@ -79,11 +77,11 @@ namespace StgSharp.Graphics.OpenGL /// /// How OpenGL use these _data, defined by /// - public void WriteMatrixData(int index, T bufferData, BufferUsage usage) - where T: unmanaged, IMatrix + public void WriteMatrixData(int index, ref IMatrix bufferData, BufferUsage usage) + where T: unmanaged, INumber { GL.BindBuffer(BufferType.ArrayBuffer, _bufferHandle[index]); - GL.SetBufferData(BufferType.ArrayBuffer, bufferData, usage); + GL.SetBufferData(BufferType.ArrayBuffer, bufferData.AsSpan(), usage); } /// @@ -101,8 +99,7 @@ namespace StgSharp.Graphics.OpenGL /// /// How OpenGL use these _data, defined by /// - public void WriteScalerData(int index, T[] bufferArray, BufferUsage usage) - where T: unmanaged, INumber + public void WriteScalerData(int index, T[] bufferArray, BufferUsage usage) where T: unmanaged, INumber { GL.BindBuffer(BufferType.ArrayBuffer, _bufferHandle[index]); GL.SetBufferData(BufferType.ArrayBuffer, bufferArray, usage); @@ -146,7 +143,7 @@ namespace StgSharp.Graphics.OpenGL /// How OpenGL use these data, defined by /// public void WriteVectorData(int index, ReadOnlySpan vectorSpan, BufferUsage usage) - where T: unmanaged, IFixedVector + where T: unmanaged, IUnmanagedVector { GL.BindBuffer(BufferType.ArrayBuffer, _bufferHandle[index]); GL.SetBufferVectorData(BufferType.ArrayBuffer, vectorSpan, usage); @@ -168,7 +165,7 @@ namespace StgSharp.Graphics.OpenGL /// How OpenGL use these _data, defined by /// public void WriteVectorData(int index, T[] vectorArray, BufferUsage usage) - where T: unmanaged, IFixedVector + where T: unmanaged, IUnmanagedVector { GL.BindBuffer(BufferType.ArrayBuffer, _bufferHandle[index]); GL.SetBufferVectorData(BufferType.ArrayBuffer, vectorArray, usage); diff --git a/StgSharp.Common/Graphics/OpenGL/glFunction.cs b/StgSharp.Common/Graphics/OpenGL/glFunction.cs index 7e0a9d21..5a28f972 100644 --- a/StgSharp.Common/Graphics/OpenGL/glFunction.cs +++ b/StgSharp.Common/Graphics/OpenGL/glFunction.cs @@ -1,36 +1,34 @@ //----------------------------------------------------------------------- // ----------------------------------------------------------------------- -// file="glFunction.cs" +// file="glFunction" // Project: StgSharp // AuthorGroup: Nitload Space // Copyright (c) Nitload Space. All rights reserved. // -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // // ----------------------------------------------------------------------- // ----------------------------------------------------------------------- using StgSharp.Graphics; using StgSharp.Internal; using StgSharp.Mathematics; +using StgSharp.Mathematics.Numeric; using System; using System.Collections.Concurrent; @@ -62,9 +60,7 @@ namespace StgSharp.Graphics.OpenGL unusedTextureImageUintInitilizing = new Lazy>( InitializeUnusedTextureImageUint); _attachmentColorRange = new Lazy( - () => { - return GetMaskInteger((uint)glConst.MAX_COLOR_ATTACHMENTS); - }); + () => { return GetMaskInteger((uint)glConst.MAX_COLOR_ATTACHMENTS); }); } public int AttachmentColorRange @@ -126,7 +122,7 @@ namespace StgSharp.Graphics.OpenGL /// /// Bind a frame BufferHandle to a frame BufferHandle target Same function as glBindFramebuffer . + /// href="https://docs._gl/gl3/glBindFramebuffer">glBindFramebuffer. /// /// /// The frame BufferHandle target of the binding operation. @@ -202,9 +198,7 @@ namespace StgSharp.Graphics.OpenGL } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void CombineFrameBufferRenderBuffer( - FrameBufferAttachment attachment, - GlHandle rboHandle) + public void CombineFrameBufferRenderBuffer(FrameBufferAttachment attachment, GlHandle rboHandle) { Context.glFramebufferRenderbuffer( glConst.FRAMEBUFFER, (uint)attachment, glConst.RENDERBUFFER, rboHandle.Value); @@ -279,9 +273,8 @@ namespace StgSharp.Graphics.OpenGL /// /// Delete a render BufferHandle object Very simlilar function as glDeleteRenderbuffers . The - /// only deifference is that this mehtod can only delete one renderbuffer at the same - /// time. + /// href="https://docs.gl/gl3/glDeleteRenderbuffers">glDeleteRenderbuffers. The only + /// deifference is that this mehtod can only delete one renderbuffer at the same time. /// /// /// Handle to BufferHandle to delete. @@ -336,12 +329,7 @@ namespace StgSharp.Graphics.OpenGL } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void DrawElementsInstanced( - GeometryType mode, - uint count, - TypeCode type, - IntPtr ptr, - uint amount) + public void DrawElementsInstanced(GeometryType mode, uint count, TypeCode type, IntPtr ptr, uint amount) { uint a; switch (type) @@ -458,8 +446,7 @@ namespace StgSharp.Graphics.OpenGL { IntPtr sptr = IntPtr.Zero; if (InternalIO.glCheckShaderStatus(ref Context, s.handle[index].Value, key, - ref sptr) == - 0) { + ref sptr) == 0) { return Marshal.PtrToStringAnsi(sptr); } return string.Empty; @@ -484,11 +471,7 @@ namespace StgSharp.Graphics.OpenGL } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void GetTextureLevelProperty( - uint textureTypeMask, - int level, - uint propertyMask, - out int propertyValue) + public void GetTextureLevelProperty(uint textureTypeMask, int level, uint propertyMask, out int propertyValue) { fixed (int* iptr = &propertyValue) { Context.glGetTexLevelParameteriv(textureTypeMask, level, propertyMask, iptr); @@ -563,8 +546,7 @@ namespace StgSharp.Graphics.OpenGL { fixed (byte* bptr = stream) { Context.glReadPixels( - beginPosition.X, beginPosition.Y, size.width, size.height, (uint)format, - (uint)dataType, bptr); + beginPosition.X, beginPosition.Y, size.width, size.height, (uint)format, (uint)dataType, bptr); } } @@ -580,15 +562,14 @@ namespace StgSharp.Graphics.OpenGL } fixed (byte* bptr = pixels) { Context.glReadPixels( - beginPosition.X, beginPosition.Y, i.Width, i.Height, (uint)format, - (uint)dataType, bptr); + beginPosition.X, beginPosition.Y, i.Width, i.Height, (uint)format, (uint)dataType, bptr); } i.PixelUpdateCount++; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public unsafe void SetBufferData(BufferType bufferType, T bufferData, BufferUsage usage) - where T: unmanaged + where T: unmanaged,INumber { int size = Marshal.SizeOf(); #pragma warning disable CS8500 @@ -598,10 +579,7 @@ namespace StgSharp.Graphics.OpenGL } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public unsafe void SetBufferData( - BufferType bufferType, - T[] bufferArray, - BufferUsage usage) + public unsafe void SetBufferData(BufferType bufferType, T[] bufferArray, BufferUsage usage) where T: unmanaged,INumber { int size = bufferArray.Length * Marshal.SizeOf(typeof(T)); @@ -618,10 +596,7 @@ namespace StgSharp.Graphics.OpenGL } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public unsafe void SetBufferData( - BufferType bufferType, - ReadOnlySpan bufferSpan, - BufferUsage usage) + public unsafe void SetBufferData(BufferType bufferType, ReadOnlySpan bufferSpan, BufferUsage usage) where T: unmanaged,INumber { int size = bufferSpan.Length * Marshal.SizeOf(typeof(T)); @@ -638,10 +613,7 @@ namespace StgSharp.Graphics.OpenGL } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public unsafe void SetBufferData( - BufferType bufferType, - Span bufferArray, - BufferUsage usage) + public unsafe void SetBufferData(BufferType bufferType, Span bufferArray, BufferUsage usage) where T: unmanaged, INumber { int size = bufferArray.Length * Marshal.SizeOf(typeof(T)); @@ -659,11 +631,8 @@ namespace StgSharp.Graphics.OpenGL } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public unsafe void SetBufferVectorData( - BufferType bufferType, - ReadOnlySpan bufferSpan, - BufferUsage usage) - where T: unmanaged, IFixedVector + public unsafe void SetBufferVectorData(BufferType bufferType, ReadOnlySpan bufferSpan, BufferUsage usage) + where T: unmanaged, IUnmanagedVector { int size = bufferSpan.Length * Marshal.SizeOf(typeof(T)); #pragma warning disable CS8500 @@ -676,11 +645,8 @@ namespace StgSharp.Graphics.OpenGL } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public unsafe void SetBufferVectorData( - BufferType bufferType, - T[] bufferArray, - BufferUsage usage) - where T: unmanaged, IFixedVector + public unsafe void SetBufferVectorData(BufferType bufferType, T[] bufferArray, BufferUsage usage) + where T: unmanaged, IUnmanagedVector { int size = bufferArray.Length * Marshal.SizeOf(typeof(T)); if (bufferArray == null) { @@ -714,17 +680,10 @@ namespace StgSharp.Graphics.OpenGL } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void SetVertexAttribute( - uint index, - int size, - TypeCode t, - bool normalized, - uint stride, - int pointer) + public void SetVertexAttribute(uint index, int size, TypeCode t, bool normalized, uint stride, int pointer) { uint type = InternalIO.GLtype[t]; - Context.glVertexAttribPointer( - index, size, type, normalized ? 1 : 0, stride, (void*)pointer); + Context.glVertexAttribPointer(index, size, type, normalized ? 1 : 0, stride, (void*)pointer); Context.glEnableVertexAttribArray(index); } @@ -745,8 +704,7 @@ namespace StgSharp.Graphics.OpenGL { T* ptr = ((pixels == null) || (pixels.Length == 0)) ? (T*)IntPtr.Zero : tptr; Context.glTexImage2D( - (uint)target, level, (uint)sourceChannel, width, height, 0, (uint)targetChannel, - (uint)type, tptr); + (uint)target, level, (uint)sourceChannel, width, height, 0, (uint)targetChannel, (uint)type, tptr); } #pragma warning restore CS8500 } @@ -767,8 +725,7 @@ namespace StgSharp.Graphics.OpenGL fixed (T* tptr = pixelSpan) { Context.glTexImage2D( - (uint)target, level, (uint)sourceChannel, width, height, 0, (uint)targetChannel, - (uint)type, tptr); + (uint)target, level, (uint)sourceChannel, width, height, 0, (uint)targetChannel, (uint)type, tptr); } #pragma warning restore CS8500 } diff --git a/StgSharp.Common/Graphics/OpenGL/glRenderStream.cs b/StgSharp.Common/Graphics/OpenGL/glRenderStream.cs index a43feb56..8928c375 100644 --- a/StgSharp.Common/Graphics/OpenGL/glRenderStream.cs +++ b/StgSharp.Common/Graphics/OpenGL/glRenderStream.cs @@ -1,34 +1,32 @@ //----------------------------------------------------------------------- // ----------------------------------------------------------------------- -// file="glRenderStream.cs" +// file="glRenderStream" // Project: StgSharp // AuthorGroup: Nitload Space // Copyright (c) Nitload Space. All rights reserved. // -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // // ----------------------------------------------------------------------- // ----------------------------------------------------------------------- using StgSharp.Mathematics; +using StgSharp.Mathematics.Graphic; using StgSharp.Threading; using System; @@ -137,9 +135,7 @@ namespace StgSharp.Graphics.OpenGL CustomizeDeinit(); } - protected sealed override Uniform NativeCameraUniform( - ShaderProgram source, - string name) + protected sealed override Uniform NativeCameraUniform(ShaderProgram source, string name) { NativeCamera.GainAllUniforms(source, name); return NativeCamera.convertedUniform; @@ -155,10 +151,7 @@ namespace StgSharp.Graphics.OpenGL } [MethodImpl(MethodImplOptions.AggressiveInlining)] - protected sealed override void NativeCameraViewTarget( - Vec3 position, - Vec3 direction, - Vec3 up) + protected sealed override void NativeCameraViewTarget(Vec3 position, Vec3 direction, Vec3 up) { NativeCamera.SetViewDirection(position, direction, up); } diff --git a/StgSharp.Common/Graphics/PlainGeometryMesh.cs b/StgSharp.Common/Graphics/PlainGeometryMesh.cs index 10daa357..5afd7254 100644 --- a/StgSharp.Common/Graphics/PlainGeometryMesh.cs +++ b/StgSharp.Common/Graphics/PlainGeometryMesh.cs @@ -1,35 +1,33 @@ //----------------------------------------------------------------------- // ----------------------------------------------------------------------- -// file="PlainGeometryMesh.cs" +// file="PlainGeometryMesh" // Project: StgSharp // AuthorGroup: Nitload Space // Copyright (c) Nitload Space. All rights reserved. // -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // // ----------------------------------------------------------------------- // ----------------------------------------------------------------------- using StgSharp.Geometries; using StgSharp.Mathematics; +using StgSharp.Mathematics.Graphic; using System; using System.Collections.Generic; diff --git a/StgSharp.Common/Graphics/RenderStream.cs b/StgSharp.Common/Graphics/RenderStream.cs index 95c66c6e..35e5d959 100644 --- a/StgSharp.Common/Graphics/RenderStream.cs +++ b/StgSharp.Common/Graphics/RenderStream.cs @@ -1,36 +1,33 @@ //----------------------------------------------------------------------- // ----------------------------------------------------------------------- -// file="RenderStream.cs" +// file="RenderStream" // Project: StgSharp // AuthorGroup: Nitload Space // Copyright (c) Nitload Space. All rights reserved. // -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // // ----------------------------------------------------------------------- // ----------------------------------------------------------------------- using StgSharp.Graphics.OpenGL; using StgSharp.Mathematics; - +using StgSharp.Mathematics.Graphic; using StgSharp.MVVM; using StgSharp.Timing; @@ -56,6 +53,7 @@ namespace StgSharp.Graphics public (int width, int height) Size { + [MethodImpl(MethodImplOptions.AggressiveInlining)] get => (Width, Height); } @@ -63,6 +61,7 @@ namespace StgSharp.Graphics public int Height { + [MethodImpl(MethodImplOptions.AggressiveInlining)] get => primeArgs.Height; } @@ -90,6 +89,7 @@ namespace StgSharp.Graphics internal IntPtr CanvasHandle { + [MethodImpl(MethodImplOptions.AggressiveInlining)] get => primeArgs.ViewPortHandle; } @@ -107,21 +107,25 @@ namespace StgSharp.Graphics protected float FramePassed { + [MethodImpl(MethodImplOptions.AggressiveInlining)] get => _timeProvider.CurrentSpan; } protected int PassedFrames { + [MethodImpl(MethodImplOptions.AggressiveInlining)] get => _timeProvider.CurrentSpan; } protected float TimePassed { + [MethodImpl(MethodImplOptions.AggressiveInlining)] get => _timeProvider.CurrentSecond; } protected TimeSpanProvider TimeProvider { + [MethodImpl(MethodImplOptions.AggressiveInlining)] get => _timeProvider; } @@ -143,8 +147,7 @@ namespace StgSharp.Graphics [MethodImpl(MethodImplOptions.AggressiveInlining)] public abstract void SetSizeLimit(int minWidth, int minHeight, int maxWidth, int maxHeight); - public static TTarget ShareContextFrom([NotNull]TSource source) - where TSource: RenderStream + public static TTarget ShareContextFrom([NotNull]TSource source) where TSource: RenderStream where TTarget: RenderStream, new() { TTarget target = new TTarget(); diff --git a/StgSharp.Common/Graphics/TextureProvider.cs b/StgSharp.Common/Graphics/TextureProvider.cs index 17fc1aba..6774abd7 100644 --- a/StgSharp.Common/Graphics/TextureProvider.cs +++ b/StgSharp.Common/Graphics/TextureProvider.cs @@ -1,40 +1,37 @@ //----------------------------------------------------------------------- -//----------------------------------------------------------------------- -// file="TextureProvider.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. +// ----------------------------------------------------------------------- +// file="TextureProvider.cs" +// Project: StgSharp +// AuthorGroup: Nitload Space +// Copyright (c) Nitload Space. All rights reserved. // -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the “Software”), to deal in the Software without restriction, +// including without limitation the rights to use, copy, modify, merge, +// publish, distribute, sublicense, and/or sell copies of the Software, +// and to permit persons to whom the Software is furnished to do so, +// subject to the following conditions: // -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. +// The above copyright notice and +// this permission notice shall be included in all copies +// or substantial portions of the Software. // -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// THE SOFTWARE IS PROVIDED “AS IS”, +// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH +// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -//----------------------------------------------------------------------- -//----------------------------------------------------------------------- -using StgSharp.Mathematics; +// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- +using StgSharp.Mathematics.Graphic; using System; -using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; -using System.Runtime.CompilerServices; -using System.Text; namespace StgSharp.Graphics { @@ -44,20 +41,20 @@ namespace StgSharp.Graphics private Vec2[] _texCoord; private Image _tex; - public TextureProvider( Image image, Vec2[] coord ) + public TextureProvider(Image image, Vec2[] coord) { _tex = image; _texCoord = coord; } - public ref Vec2 this[ int index ] + public ref Vec2 this[int index] { - get => ref _texCoord[ index ]; + get => ref _texCoord[index]; } public Span TextureCoordinate { - get => new Span( _texCoord ); + get => new Span(_texCoord); } public Image ProvideImage() @@ -65,23 +62,23 @@ namespace StgSharp.Graphics return _tex; } - public void ReadImage( IImageProvider provider ) + public void ReadImage(IImageProvider provider) { _tex = provider.ProvideImage(); } - public void UpdateFromImage( [NotNull]Image i ) + public void UpdateFromImage([NotNull]Image i) { - if( i == _tex ) { + if (i == _tex) { return; } - if( i.Size == _tex.Size ) + if (i.Size == _tex.Size) { _tex = i; } else { throw new ArgumentException( - $"Size of {nameof(i)} does not equals to current image." ); + $"Size of {nameof(i)} does not equals to current image."); } } diff --git a/StgSharp.Common/MVVM/ViewModel/ViewModel.cs b/StgSharp.Common/MVVM/ViewModel/ViewModel.cs index c0ec92c9..712f1bde 100644 --- a/StgSharp.Common/MVVM/ViewModel/ViewModel.cs +++ b/StgSharp.Common/MVVM/ViewModel/ViewModel.cs @@ -1,30 +1,27 @@ //----------------------------------------------------------------------- // ----------------------------------------------------------------------- -// file="ViewModel.cs" +// file="ViewModel" // Project: StgSharp // AuthorGroup: Nitload Space // Copyright (c) Nitload Space. All rights reserved. // -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // // ----------------------------------------------------------------------- // ----------------------------------------------------------------------- @@ -32,6 +29,7 @@ using StgSharp.Controlling.UsrActivity; using StgSharp.Graphics; using StgSharp.Graphics.OpenGL; using StgSharp.Mathematics; +using StgSharp.Mathematics.Graphic; using StgSharp.MVVM; using StgSharp.MVVM.ViewModel; using StgSharp.Threading; @@ -142,7 +140,7 @@ namespace StgSharp.MVVM.ViewModel /// public int Height { -[MethodImpl(MethodImplOptions.AggressiveInlining)] + [MethodImpl(MethodImplOptions.AggressiveInlining)] get => viewPortDisplay.Height; } @@ -151,19 +149,19 @@ namespace StgSharp.MVVM.ViewModel /// public int Width { -[MethodImpl(MethodImplOptions.AggressiveInlining)] + [MethodImpl(MethodImplOptions.AggressiveInlining)] get => viewPortDisplay.Width; } public unsafe IntPtr WindowID { -[MethodImpl(MethodImplOptions.AggressiveInlining)] + [MethodImpl(MethodImplOptions.AggressiveInlining)] get => viewPortDisplay.ViewPortHandle; } public string Name { -[MethodImpl(MethodImplOptions.AggressiveInlining)] + [MethodImpl(MethodImplOptions.AggressiveInlining)] get => viewPortDisplay.Name; } @@ -172,13 +170,13 @@ namespace StgSharp.MVVM.ViewModel /// public Vec2 Size { -[MethodImpl(MethodImplOptions.AggressiveInlining)] + [MethodImpl(MethodImplOptions.AggressiveInlining)] get => new Vec2(Width, Height); } public ViewPort ViewPortBinding { -[MethodImpl(MethodImplOptions.AggressiveInlining)] + [MethodImpl(MethodImplOptions.AggressiveInlining)] get => viewPortDisplay; } diff --git a/StgSharp.Common/Mathematics/Linear/Cordination.cs b/StgSharp.Common/Mathematics/Linear/Cordination.cs index 1761ad62..180f8e63 100644 --- a/StgSharp.Common/Mathematics/Linear/Cordination.cs +++ b/StgSharp.Common/Mathematics/Linear/Cordination.cs @@ -1,33 +1,30 @@ //----------------------------------------------------------------------- -//----------------------------------------------------------------------- -// file="Cordination.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. +// ----------------------------------------------------------------------- +// file="Cordination" +// Project: StgSharp +// AuthorGroup: Nitload Space +// Copyright (c) Nitload Space. All rights reserved. // -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -//----------------------------------------------------------------------- -//----------------------------------------------------------------------- +// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- namespace StgSharp.Mathematics.Numeric { public enum CoordinatePlain diff --git a/StgSharp.Common/Mathematics/Linear/IUnmanagedVector.cs b/StgSharp.Common/Mathematics/Linear/IUnmanagedVector.cs index 47db6a14..88262747 100644 --- a/StgSharp.Common/Mathematics/Linear/IUnmanagedVector.cs +++ b/StgSharp.Common/Mathematics/Linear/IUnmanagedVector.cs @@ -1,6 +1,6 @@ //----------------------------------------------------------------------- // ----------------------------------------------------------------------- -// file="IFixedVector.cs" +// file="IUnmanagedVector.cs" // Project: StgSharp // AuthorGroup: Nitload Space // Copyright (c) Nitload Space. All rights reserved. diff --git a/StgSharp.Common/Stg/Bullet.cs b/StgSharp.Common/Stg/Bullet.cs index c2a1cbf5..72985869 100644 --- a/StgSharp.Common/Stg/Bullet.cs +++ b/StgSharp.Common/Stg/Bullet.cs @@ -1,35 +1,33 @@ //----------------------------------------------------------------------- -//----------------------------------------------------------------------- -// file="Bullet.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. +// ----------------------------------------------------------------------- +// file="Bullet" +// Project: StgSharp +// AuthorGroup: Nitload Space +// Copyright (c) Nitload Space. All rights reserved. // -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -//----------------------------------------------------------------------- -//----------------------------------------------------------------------- +// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- using StgSharp.Geometries; using StgSharp.Mathematics; +using StgSharp.Mathematics.Graphic; using System; @@ -43,14 +41,14 @@ namespace StgSharp.Gaming GeometryMotion movement, Vec2 beginPosition, float angle, - float scale ) + float scale) { - ArgumentNullException.ThrowIfNull( buffer ); + ArgumentNullException.ThrowIfNull(buffer); GlobalBuffer = buffer; BufferId = buffer.CreateInstanceID(); - ( ( IInstancing )this ).Scale = scale; - ( ( IInstancing )this ).Coord = new Vec3( beginPosition, 0 ); - ( ( IInstancing )this ).Rotation = angle; + ((IInstancing)this).Scale = scale; + ((IInstancing)this).Coord = new Vec3(beginPosition, 0); + ((IInstancing)this).Rotation = angle; Motion = movement; } @@ -62,12 +60,16 @@ namespace StgSharp.Gaming public Vec2 CenterPosition { get; set; } - public bool CollideWith( IPlainEntity entity ) + public bool CollideWith(IPlainEntity entity) { throw new System.NotImplementedException(); } - Vec3 IInstancing.CenterPositionGlobal { get; set; } + Vec3 IInstancing.CenterPositionGlobal + { + get => throw new NotImplementedException(); + set => throw new NotImplementedException(); + } } } \ No newline at end of file diff --git a/StgSharp.Common/Stg/CollisionTexture.cs b/StgSharp.Common/Stg/CollisionTexture.cs index 691e304b..440af6d5 100644 --- a/StgSharp.Common/Stg/CollisionTexture.cs +++ b/StgSharp.Common/Stg/CollisionTexture.cs @@ -1,30 +1,27 @@ //----------------------------------------------------------------------- // ----------------------------------------------------------------------- -// file="CollisionTexture.cs" +// file="CollisionTexture" // Project: StgSharp // AuthorGroup: Nitload Space // Copyright (c) Nitload Space. All rights reserved. // -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // // ----------------------------------------------------------------------- // ----------------------------------------------------------------------- @@ -34,6 +31,7 @@ using StgSharp.Graphics.OpenGL; using StgSharp.Internal; using StgSharp.Mathematics; +using StgSharp.Mathematics.Graphic; using StgSharp.MVVM; using System; @@ -94,8 +92,7 @@ namespace StgSharp.Stg vbo.WriteVectorData(0, item.CoordAndRotationSpan, BufferUsage.StreamDraw); vao.SetVertexAttribute(1, 3, TypeCode.Single, false, 4 * sizeof(float), 0); - vao.SetVertexAttribute( - 2, 1, TypeCode.Single, false, 4 * sizeof(float), 3 * sizeof(float)); + vao.SetVertexAttribute(2, 1, TypeCode.Single, false, 4 * sizeof(float), 3 * sizeof(float)); vbo.WriteScalerData(2, item.ScalingSpan, BufferUsage.StreamDraw); vao.SetVertexAttribute(3, 1, TypeCode.Single, false, sizeof(float), 0); @@ -159,9 +156,8 @@ namespace StgSharp.Stg t = CreateTexture(1); t.Bind2D(0); GL.TextureImage2d( - Texture2DTarget.Texture2D, 0, ImageChannel.WithAlphaChannel, (uint)Width, - (uint)Height, ImageChannel.WithAlphaChannel, PixelChannelLayout.Byte, - Array.Empty()); + Texture2DTarget.Texture2D, 0, ImageChannel.WithAlphaChannel, (uint)Width, (uint)Height, + ImageChannel.WithAlphaChannel, PixelChannelLayout.Byte, Array.Empty()); t.Set2dWrapProperty(0, TextureWrap.Repeat, TextureWrap.Repeat); t.Set2dFilterProperty(0, TextureFilter.Nearest, TextureFilter.Nearest); diff --git a/StgSharp.Model/Step/Items/StepTriple.cs b/StgSharp.Model/Step/Items/StepTriple.cs index 10941a1e..b57eaef8 100644 --- a/StgSharp.Model/Step/Items/StepTriple.cs +++ b/StgSharp.Model/Step/Items/StepTriple.cs @@ -29,7 +29,7 @@ // ----------------------------------------------------------------------- // ----------------------------------------------------------------------- using StgSharp.Mathematics; - +using StgSharp.Mathematics.Graphic; using StgSharp.Model.Step; using StgSharp.Script; using StgSharp.Script.Express; @@ -79,11 +79,7 @@ namespace StgSharp.Model.Step return false; } - return ItemType == other.ItemType && - X == other.X && - Y == other.Y && - Z == other.Z && - Name == other.Name; + return ItemType == other.ItemType && X == other.X && Y == other.Y && Z == other.Z && Name == other.Name; } public override bool Equals(object obj) diff --git a/StgSharp.Model/Step/Items/StepVertex.cs b/StgSharp.Model/Step/Items/StepVertex.cs index b48eb962..b899f65c 100644 --- a/StgSharp.Model/Step/Items/StepVertex.cs +++ b/StgSharp.Model/Step/Items/StepVertex.cs @@ -29,6 +29,7 @@ // ----------------------------------------------------------------------- // ----------------------------------------------------------------------- using StgSharp.Mathematics; +using StgSharp.Mathematics.Graphic; using StgSharp.Model.Step; using StgSharp.Script; using StgSharp.Script.Express; diff --git a/StgSharp.Model/Step/StepDataParser.cs b/StgSharp.Model/Step/StepDataParser.cs index 70d15d3f..78db1025 100644 --- a/StgSharp.Model/Step/StepDataParser.cs +++ b/StgSharp.Model/Step/StepDataParser.cs @@ -31,6 +31,7 @@ using Microsoft.CodeAnalysis.CSharp.Syntax; using StgSharp.Mathematics; +using StgSharp.Mathematics.Graphic; using StgSharp.Script.Express; using System; @@ -48,9 +49,7 @@ namespace StgSharp.Model.Step private static Regex _vectorParser = GetVectorParser(); private static Type _implementorInterface = typeof(IExpConvertableFrom<>); - public static StepRepresentationItem Implement( - StepRepresentationItem left, - StepRepresentationItem right) + public static StepRepresentationItem Implement(StepRepresentationItem left, StepRepresentationItem right) { Type tLeft = left.GetType(), tRight = right.GetType(), diff --git a/StgSharpDebug/MatrixParallelTest.cs b/StgSharpDebug/MatrixParallelTest.cs index eaa331ea..55bb5119 100644 --- a/StgSharpDebug/MatrixParallelTest.cs +++ b/StgSharpDebug/MatrixParallelTest.cs @@ -1,34 +1,33 @@ //----------------------------------------------------------------------- // ----------------------------------------------------------------------- -// file="MatrixParallelTest.cs" +// file="MatrixParallelTest" // Project: StgSharp // AuthorGroup: Nitload Space // Copyright (c) Nitload Space. All rights reserved. // -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the ¡°Software¡±), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED ¡°AS IS¡±, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // // ----------------------------------------------------------------------- // ----------------------------------------------------------------------- using StgSharp.Mathematics; +using StgSharp.Mathematics.Numeric; + using System; using System.Diagnostics; using System.Threading; @@ -37,7 +36,7 @@ namespace StgSharp { internal partial class Program { - + /* public static void TestMatrixParallel() { // 4. Ï̵߳÷¶Ȼù´¡¹¦ÄܲâÊÔ @@ -193,6 +192,7 @@ namespace StgSharp Console.WriteLine($"? »ù±¾µ÷¶ȲÙ×÷²âÊÔʧ°Ü: {ex.Message}"); } } + /**/ } } \ No newline at end of file diff --git a/StgSharpDebug/MatrixParallelThreadTest.cs b/StgSharpDebug/MatrixParallelThreadTest.cs index e5ea7f44..1027cc09 100644 --- a/StgSharpDebug/MatrixParallelThreadTest.cs +++ b/StgSharpDebug/MatrixParallelThreadTest.cs @@ -1,30 +1,27 @@ //----------------------------------------------------------------------- // ----------------------------------------------------------------------- -// file="MatrixParallelThreadTest.cs" +// file="MatrixParallelThreadTest" // Project: StgSharp // AuthorGroup: Nitload Space // Copyright (c) Nitload Space. All rights reserved. // -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // // ----------------------------------------------------------------------- // ----------------------------------------------------------------------- @@ -34,6 +31,7 @@ using System.Threading; namespace StgSharp { + /* /// /// 矩阵计算并发调度器线程调度测试 修复的问题: 1. 添加了ResetThreadCount()方法,在每轮任务调度前重置线程计数 2. /// 调度器线程不再递减RemainThreadCount,只有工作线程才递减 3. 改进了控制台输出,显示更清晰的线程活动信息 使用方法:在Program.cs的Main方法中调用 @@ -114,4 +112,5 @@ namespace StgSharp } } + /**/ } diff --git a/StgSharpDebug/Program.cs b/StgSharpDebug/Program.cs index bb32398a..f4835a5b 100644 --- a/StgSharpDebug/Program.cs +++ b/StgSharpDebug/Program.cs @@ -1,30 +1,27 @@ //----------------------------------------------------------------------- // ----------------------------------------------------------------------- -// file="Program.cs" +// file="Program" // Project: StgSharp // AuthorGroup: Nitload Space // Copyright (c) Nitload Space. All rights reserved. // -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // // ----------------------------------------------------------------------- // ----------------------------------------------------------------------- @@ -35,6 +32,7 @@ using StgSharp.Graphics; using StgSharp.HighPerformance; using StgSharp.HighPerformance.Memory; using StgSharp.Mathematics; +using StgSharp.Mathematics.Numeric; using StgSharp.Model.Step; using StgSharp.MVVM; using StgSharp.MVVM.ViewModel; @@ -61,7 +59,7 @@ namespace StgSharp { World.Init(); - TestMatrixParallel(); + // TestMatrixParallel(); // 原有的矩阵测试代码 HybridLayerSegregatedFitAllocator hlsf = new HybridLayerSegregatedFitAllocator(64 * 400 * 400); diff --git a/StgSharpDebug/RenderStream/Partical.cs b/StgSharpDebug/RenderStream/Partical.cs index 5f1df2f0..d339b8b2 100644 --- a/StgSharpDebug/RenderStream/Partical.cs +++ b/StgSharpDebug/RenderStream/Partical.cs @@ -1,30 +1,27 @@ //----------------------------------------------------------------------- // ----------------------------------------------------------------------- -// file="Partical.cs" +// file="Partical" // Project: StgSharp // AuthorGroup: Nitload Space // Copyright (c) Nitload Space. All rights reserved. // -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // // ----------------------------------------------------------------------- // ----------------------------------------------------------------------- @@ -34,6 +31,7 @@ using StgSharp.Graphics; using StgSharp.Graphics.OpenGL; using StgSharp.Internal.OpenGL; using StgSharp.Mathematics; +using StgSharp.Mathematics.Graphic; using StgSharp.Timing; using System; @@ -125,8 +123,8 @@ namespace StgSharp /**/ GL.TextureImage2d( - Texture2DTarget.Texture2D, 0, ImageChannel.WithAlphaChannel, (uint)Width, - (uint)Height, ImageChannel.WithAlphaChannel, PixelChannelLayout.Byte, null); + Texture2DTarget.Texture2D, 0, ImageChannel.WithAlphaChannel, (uint)Width, (uint)Height, + ImageChannel.WithAlphaChannel, PixelChannelLayout.Byte, null); /**/ // GL.Assert(false); @@ -194,10 +192,7 @@ namespace StgSharp GL.Assert(false); } - public void RenderButton( - ButtonStatus status, - float statusBegin, - in TextureProvider provider) + public void RenderButton(ButtonStatus status, float statusBegin, in TextureProvider provider) { provider.UpdateFromImage(i); } @@ -269,8 +264,7 @@ namespace StgSharp ebo = CreateElementBuffer(1); vbo.Bind(0); - Rectangle rec = new Rectangle( - 0.05f, 0.05f, 0.05f, -0.05f, -0.05f, -0.05f, -0.05f, 0.05f); + Rectangle rec = new Rectangle(0.05f, 0.05f, 0.05f, -0.05f, -0.05f, -0.05f, -0.05f, 0.05f); // GL.Assert(true); vao.Bind(0); @@ -280,8 +274,7 @@ namespace StgSharp vbo.WriteVectorData(1, buffer.CoordAndRotationSpan, BufferUsage.StreamDraw); vao.SetVertexAttribute(1, 3, TypeCode.Single, false, 4 * sizeof(float), 0); - vao.SetVertexAttribute( - 2, 1, TypeCode.Single, false, 4 * sizeof(float), 3 * sizeof(float)); + vao.SetVertexAttribute(2, 1, TypeCode.Single, false, 4 * sizeof(float), 3 * sizeof(float)); GL.VertexAttributeDivisor(1, 1); GL.VertexAttributeDivisor(2, 1); @@ -294,7 +287,7 @@ namespace StgSharp vbo.Unbind(); GL.BindVertexArray(GlHandle.Zero); - NativeCameraViewTarget([0f, 0f, -100f], [0f, 0f, 0f], [0f, 1f, 0f]); + NativeCameraViewTarget([ 0f, 0f, -100f ], [ 0f, 0f, 0f ], [ 0f, 1f, 0f ]); NativeCameraViewRange(new Degree(1.5f), Vec2.Zero, (50, 50)); NativeCameraUniform(s, "Camera"); @@ -309,8 +302,8 @@ namespace StgSharp t = CreateTexture(1); t.Bind2D(0); GL.TextureImage2d( - Texture2DTarget.Texture2D, 0, ImageChannel.WithAlphaChannel, (uint)Width, - (uint)Height, ImageChannel.WithAlphaChannel, PixelChannelLayout.Byte, null!); + Texture2DTarget.Texture2D, 0, ImageChannel.WithAlphaChannel, (uint)Width, (uint)Height, + ImageChannel.WithAlphaChannel, PixelChannelLayout.Byte, null!); t.Set2dWrapProperty(0, TextureWrap.Repeat, TextureWrap.Repeat); t.Set2dFilterProperty(0, TextureFilter.Linear, TextureFilter.Linear); diff --git a/StgSharpDebug/StgSharpDebug.csproj b/StgSharpDebug/StgSharpDebug.csproj index abb6d35b..ae37e1dd 100644 --- a/StgSharpDebug/StgSharpDebug.csproj +++ b/StgSharpDebug/StgSharpDebug.csproj @@ -65,6 +65,7 @@ +