Beispiel #1
0
        /// デバック用
        ///---------------------------------------------------------------------------
        /// デバック用:描画
        public void Draw( DemoGame.GraphicsDevice graphDev, Rgba color )
        {
            DemoGame.RenderGeometry        drawTri = new DemoGame.RenderGeometry();
            drawTri.MakeTriangle();

            DemoGame.Camera camera = graphDev.GetCurrentCamera();

            for( int i=0; i<EntryNum; i++ ){
            drawTri.DrawTriangle( graphDev.Graphics, Triangle[i], camera, color );
            }

            drawTri        = null;
        }
Beispiel #2
0
        public static Rgba Average( this Rgba rgba, Rgba rgba2, double weight = 1 )
        {
            var r = ( ( rgba.Red * weight ) + rgba2.Red ) / ( 1 + weight );
              var g = ( ( rgba.Green * weight ) + rgba2.Green ) / ( 1 + weight );
              var b = ( ( rgba.Blue * weight ) + rgba2.Blue ) / ( 1 + weight );
              var a = ( ( rgba.Alpha * weight ) + rgba2.Alpha ) / ( 1 + weight );

              return new Rgba{
            Red = (byte) r.Clamp( 0, 255 ),
            Green = (byte) g.Clamp( 0, 255 ),
            Blue = (byte) b.Clamp( 0, 255 ),
            Alpha = (byte) a.Clamp( 0, 255 )
              };
        }
Beispiel #3
0
        /// private メソッド
        ///---------------------------------------------------------------------------
        /// デバック用
        ///---------------------------------------------------------------------------
        /// デバック用:描画
        public void Draw( DemoGame.GraphicsDevice graphDev, int hitIdx, Rgba color1, Rgba color2 )
        {
            DemoGame.RenderGeometry        drawSph = new DemoGame.RenderGeometry();
            drawSph.MakeCapsule();

            DemoGame.Camera camera = graphDev.GetCurrentCamera();

            if( hitIdx < 0 ){
            drawSph.DrawCapsule( graphDev.Graphics, this.Capsule, camera, color1 );
            }
            else{
            drawSph.DrawCapsule( graphDev.Graphics, this.Capsule, camera, color2 );
            }

            drawSph        = null;
        }
Beispiel #4
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="input"></param>
        public override void Parse( Stream input )
        {
            _GlowColor = new Rgba( this.Version );
            _GlowColor.Parse( input );

            BinaryReader br = new BinaryReader( input );

            _BlurX = br.ReadUInt32();
            _BlurY = br.ReadUInt32();
            _Strength = br.ReadUInt16();

            BitStream bits = new BitStream( input );
            _InnerGlow = ( 0 != bits.GetBits( 1 ) );
            _KnockOut = ( 0 != bits.GetBits( 1 ) );
            _CompositeSource = ( 0 != bits.GetBits( 1 ) );
            _Passes = ( byte )bits.GetBits( 5 );
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="input"></param>
        public override void Parse( Stream input )
        {
            BinaryReader br = new BinaryReader( input );

            _numColors = br.ReadByte();

            _GradientColors = new List<Rgba>();
            for ( int i = 0; i < _numColors; i++ )
            {
                Rgba entry = new Rgba( this.Version );
                entry.Parse( input );
                _GradientColors.Add( entry );
            }
            _GradientRatio = new List<byte>();
            for ( int i = 0; i < _numColors; i++ )
            {
                byte entry2 = br.ReadByte();
                _GradientRatio.Add( entry2 );
            }

            _BlurX = br.ReadUInt32();
            _BlurY = br.ReadUInt32();
            _Angle = br.ReadUInt32();
            _Distance = br.ReadUInt32();
            _Strength = br.ReadUInt16();

            BitStream bits = new BitStream( input );
            _InnerShadow = ( 0 != bits.GetBits( 1 ) );
            _KnockOut = ( 0 != bits.GetBits( 1 ) );
            _CompositeSource = ( 0 != bits.GetBits( 1 ) );
            if ( !_CompositeSource )
            {
                throw new SwfFormatException( "GradientGlowFilter with CompositeSource false" );
            }
            _OnTop = ( 0 != bits.GetBits( 1 ) );
            _Passes = ( byte )bits.GetBits( 4 );
        }
Beispiel #6
0
 /// <summary>
 /// Creates a checkpoint for a all players, with given type, position, radius, height and color.
 /// </summary>
 /// <param name="type">The type of the checkpoint.</param>
 /// <param name="pos">The position of the checkpoint.</param>
 /// <param name="radius">The size of the checkpoint.</param>
 /// <param name="height">The height of the checkpoint.</param>
 /// <param name="color">The color of the checkpoint.</param>
 /// <returns></returns>
 public static ICheckpoint CreateCheckpoint(CheckpointType type, Position pos, float radius,
                                            float height,
                                            Rgba color) =>
 Module.Server.CreateCheckpoint(null, (byte)type, pos, radius, height, color);
Beispiel #7
0
        /// Grid mesh
        static public MeshData CreateGrid(
            float width,
            float depth,
            int divW,                               ///< Tesselation along width
            int divD,                               ///< Tesselation along depth
            Rgba colorG,                            ///< Color of grid lines
            Rgba colorW,                            ///< Color of center line, x axis direction
            Rgba colorD                             ///< Color of center line, z axis direction
            )
        {
            int lineNum = (divW + divD + 2);            // Number of lines
            int vtxNum  = 2 * lineNum;                  // Number of vertices

            MeshData mesh = new MeshData(DrawMode.Lines, vtxNum, vtxNum);

            float mx = -(width / 2.0f);
            float mz = -(depth / 2.0f);

            float xstep = (width / divW);
            float zstep = (depth / divD);

            int   i;
            int   idx;
            float x = mx;

            // Draw a line on the z direction, starting from -x and incrementing x
            for (i = 0; i < (divW + 1); i++)
            {
                idx = i * 2;
                mesh.Positions[(idx * 3) + 0] = x;
                mesh.Positions[(idx * 3) + 1] = 0.0f;
                mesh.Positions[(idx * 3) + 2] = -mz;

                mesh.Positions[((idx + 1) * 3) + 0] = x;
                mesh.Positions[((idx + 1) * 3) + 1] = 0.0f;
                mesh.Positions[((idx + 1) * 3) + 2] = mz;
                x += xstep;
            }

            // Draw a line on the x direction, starting from -z and incrementing z
            float z = mz;

            for (; i < lineNum; i++)
            {
                idx = i * 2;
                mesh.Positions[(idx * 3) + 0] = -mx;
                mesh.Positions[(idx * 3) + 1] = 0.0f;
                mesh.Positions[(idx * 3) + 2] = z;

                mesh.Positions[((idx + 1) * 3) + 0] = mx;
                mesh.Positions[((idx + 1) * 3) + 1] = 0.0f;
                mesh.Positions[((idx + 1) * 3) + 2] = z;
                z += zstep;
            }

            for (i = 0; i < vtxNum; i++)
            {
                mesh.Normals[(i * 3) + 0] = 0.0f;
                mesh.Normals[(i * 3) + 1] = 1.0f;
                mesh.Normals[(i * 3) + 2] = 0.0f;
                mesh.Colors[(i * 4) + 0]  = colorG.R / 255.0f;
                mesh.Colors[(i * 4) + 1]  = colorG.G / 255.0f;
                mesh.Colors[(i * 4) + 2]  = colorG.B / 255.0f;
                mesh.Colors[(i * 4) + 3]  = colorG.A / 255.0f;
            }

            // Change the color of the center lines
            if ((divW & 1) == 0 && (divD & 1) == 0)
            {
                mesh.Colors[(divW * 4) + 0] = colorW.R / 255.0f;
                mesh.Colors[(divW * 4) + 1] = colorW.G / 255.0f;
                mesh.Colors[(divW * 4) + 2] = colorW.B / 255.0f;
                mesh.Colors[(divW * 4) + 3] = colorW.A / 255.0f;

                mesh.Colors[((divW + 1) * 4) + 0] = colorW.R / 255.0f;
                mesh.Colors[((divW + 1) * 4) + 1] = colorW.G / 255.0f;
                mesh.Colors[((divW + 1) * 4) + 2] = colorW.B / 255.0f;
                mesh.Colors[((divW + 1) * 4) + 3] = colorW.A / 255.0f;

                int ofst = (divW + 1) * 2;
                mesh.Colors[((ofst + divD) * 4) + 0] = colorD.R / 255.0f;
                mesh.Colors[((ofst + divD) * 4) + 1] = colorD.G / 255.0f;
                mesh.Colors[((ofst + divD) * 4) + 2] = colorD.B / 255.0f;
                mesh.Colors[((ofst + divD) * 4) + 3] = colorD.A / 255.0f;

                mesh.Colors[((ofst + divD + 1) * 4) + 0] = colorD.R / 255.0f;
                mesh.Colors[((ofst + divD + 1) * 4) + 1] = colorD.G / 255.0f;
                mesh.Colors[((ofst + divD + 1) * 4) + 2] = colorD.B / 255.0f;
                mesh.Colors[((ofst + divD + 1) * 4) + 3] = colorD.A / 255.0f;
            }

            for (i = 0; i < vtxNum; i++)
            {
                mesh.Indices[i] = (ushort)i;
            }

            return(mesh);
        }
Beispiel #8
0
 internal static extern void Vehicle_SetNeonColor(IntPtr vehicle, Rgba color);
Beispiel #9
0
 internal static extern void Vehicle_SetTireSmokeColor(IntPtr vehicle, Rgba color);
Beispiel #10
0
 internal static extern void Vehicle_SetSecondaryColorRGB(IntPtr vehicle, Rgba color);
Beispiel #11
0
        /// Line描画
        public void DrawLine( GraphicsContext graphics, GeometryLine trgLine, Camera cam, Rgba color )
        {
            if( debShader == null ){
            return ;
            }

            /// バーテクスの更新
            ///------------------------------------------------------------
            for( int i=0; i<2; i++ ){
            debMesh.Positions[ i*3+0 ] = trgLine.GetPos(i).X;
            debMesh.Positions[ i*3+1 ] = trgLine.GetPos(i).Y;
            debMesh.Positions[ i*3+2 ] = trgLine.GetPos(i).Z;

            debMesh.Normals[ i*3+0 ] = 0.0f;
            debMesh.Normals[ i*3+1 ] = 1.0f;
            debMesh.Normals[ i*3+2 ] = 0.0f;
            }

            debVb.SetVertices( 0, debMesh.Positions );
            debVb.SetIndices( debMesh.Indices );

            drawMesh( graphics, cam, color );
        }
Beispiel #12
0
	public Sprite2D( Sprite2DBatch batch, Sprite2DMaterial material = null, int zIndex = 0 )
	{
		this.batch = batch ;
		this.material = material ?? Sprite2DMaterial.DefaultMaterial ;
		this.zIndex = zIndex ;
		vertexID = -1 ;
		indexID = -1 ;
		UpdateSortKey( false ) ;
		batch.AddSprite( this ) ;

		Center = new Vector2( 0.5f ) ;
		UVSize = new Vector2( 1.0f ) ;
		Color = new Rgba( 255, 255, 255, 255 ) ;
			
		updateFlag = false;
	}
        /// グリッドのメッシュ
        static public MeshData CreateGrid(
            float width,                            ///< 横幅
            float depth,                            ///< 奥行き
            int divW,                               ///< 横幅の分割数
            int divD,                               ///< 奥行きの分割数
            Rgba colorG,                            ///< グリッドの線の色
            Rgba colorW,                            ///< 中心の線の色(x軸方向)
            Rgba colorD                             ///< 中心の線の色(z軸方向)
            )
        {
            int lineNum = (divW + divD + 2);            // ラインの本数
            int vtxNum  = 2 * lineNum;                  // 頂点数

            MeshData mesh = new MeshData(DrawMode.Lines, vtxNum, vtxNum);

            float mx = -(width / 2.0f);
            float mz = -(depth / 2.0f);

            float xstep = (width / divW);
            float zstep = (depth / divD);

            int   i;
            int   idx;
            float x = mx;

            // -xから始まって xを増やしながらz方向に線を引く
            for (i = 0; i < (divW + 1); i++)
            {
                idx = i * 2;
                mesh.Positions[(idx * 3) + 0] = x;
                mesh.Positions[(idx * 3) + 1] = 0.0f;
                mesh.Positions[(idx * 3) + 2] = -mz;

                mesh.Positions[((idx + 1) * 3) + 0] = x;
                mesh.Positions[((idx + 1) * 3) + 1] = 0.0f;
                mesh.Positions[((idx + 1) * 3) + 2] = mz;
                x += xstep;
            }

            // -zから始まって zを増やしながらx方向に線を引く
            float z = mz;

            for (; i < lineNum; i++)
            {
                idx = i * 2;
                mesh.Positions[(idx * 3) + 0] = -mx;
                mesh.Positions[(idx * 3) + 1] = 0.0f;
                mesh.Positions[(idx * 3) + 2] = z;

                mesh.Positions[((idx + 1) * 3) + 0] = mx;
                mesh.Positions[((idx + 1) * 3) + 1] = 0.0f;
                mesh.Positions[((idx + 1) * 3) + 2] = z;
                z += zstep;
            }

            for (i = 0; i < vtxNum; i++)
            {
                mesh.Normals[(i * 3) + 0] = 0.0f;
                mesh.Normals[(i * 3) + 1] = 1.0f;
                mesh.Normals[(i * 3) + 2] = 0.0f;
                mesh.Colors[(i * 4) + 0]  = colorG.R / 255.0f;
                mesh.Colors[(i * 4) + 1]  = colorG.G / 255.0f;
                mesh.Colors[(i * 4) + 2]  = colorG.B / 255.0f;
                mesh.Colors[(i * 4) + 3]  = colorG.A / 255.0f;
            }

            // センター線の色を変える
            if ((divW & 1) == 0 && (divD & 1) == 0)
            {
                mesh.Colors[(divW * 4) + 0] = colorW.R / 255.0f;
                mesh.Colors[(divW * 4) + 1] = colorW.G / 255.0f;
                mesh.Colors[(divW * 4) + 2] = colorW.B / 255.0f;
                mesh.Colors[(divW * 4) + 3] = colorW.A / 255.0f;

                mesh.Colors[((divW + 1) * 4) + 0] = colorW.R / 255.0f;
                mesh.Colors[((divW + 1) * 4) + 1] = colorW.G / 255.0f;
                mesh.Colors[((divW + 1) * 4) + 2] = colorW.B / 255.0f;
                mesh.Colors[((divW + 1) * 4) + 3] = colorW.A / 255.0f;

                int ofst = (divW + 1) * 2;
                mesh.Colors[((ofst + divD) * 4) + 0] = colorD.R / 255.0f;
                mesh.Colors[((ofst + divD) * 4) + 1] = colorD.G / 255.0f;
                mesh.Colors[((ofst + divD) * 4) + 2] = colorD.B / 255.0f;
                mesh.Colors[((ofst + divD) * 4) + 3] = colorD.A / 255.0f;

                mesh.Colors[((ofst + divD + 1) * 4) + 0] = colorD.R / 255.0f;
                mesh.Colors[((ofst + divD + 1) * 4) + 1] = colorD.G / 255.0f;
                mesh.Colors[((ofst + divD + 1) * 4) + 2] = colorD.B / 255.0f;
                mesh.Colors[((ofst + divD + 1) * 4) + 3] = colorD.A / 255.0f;
            }

            for (i = 0; i < vtxNum; i++)
            {
                mesh.Indices[i] = (ushort)i;
            }

            return(mesh);
        }
Beispiel #14
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="input"></param>
        public override void Parse( Stream input )
        {
            BinaryReader br = new BinaryReader( input );

            _ShadowColor = new Rgba( this.Version );
            _ShadowColor.Parse( input );
            _HighlightColor = new Rgba( this.Version );
            _HighlightColor.Parse( input );

            _BlurX = br.ReadUInt32();
            _BlurY = br.ReadUInt32();
            _Angle = br.ReadUInt32();
            _Distance = br.ReadUInt32();
            _Strength = br.ReadUInt16();

            BitStream bits = new BitStream( input );
            _InnerShadow = ( 0 != bits.GetBits( 1 ) );
            _KnockOut = ( 0 != bits.GetBits( 1 ) );
            _CompositeSource = ( 0 != bits.GetBits( 1 ) );
            if ( !_CompositeSource )
            {
                throw new SwfFormatException( "BevelFilter with CompositeSource false" );
            }
            _OnTop = ( 0 != bits.GetBits( 1 ) );
            _Passes = ( byte )bits.GetBits( 4 );
        }
Beispiel #15
0
        /// 球描画
        public void DrawSphere( GraphicsContext graphics, GeometrySphere trgSph, Camera cam, Rgba color )
        {
            if( debShader == null ){
            return ;
            }

            debVb.SetVertices( 0, debMesh.Positions );
            debVb.SetIndices( debMesh.Indices );

             		Matrix4 world = Matrix4.Translation( new Vector3( trgSph.X, trgSph.Y, trgSph.Z ) ) * Matrix4.Scale( new Vector3( trgSph.R, trgSph.R, trgSph.R ) );
            Matrix4 worldViewProj = cam.Projection * cam.View * world;

            // uniform value
            debShader.SetUniformValue( debUIdWVP, ref worldViewProj );

            Vector4 a_Color = new Vector4( (color.R / 255.0f), (color.G / 255.0f), (color.B / 255.0f), (color.A / 255.0f) );
            debShader.SetUniformValue( debShader.FindUniform( "IAmbient" ), ref a_Color );

            graphics.SetShaderProgram( debShader );

            graphics.SetVertexBuffer( 0, debVb );
            graphics.DrawArrays( debMesh.Prim, 0, debMesh.IndexCount );
        }
 public PointLight(Point4D location, float intensity, Rgba colourRgba) : base(intensity, colourRgba)
 {
     Location = location;
 }
Beispiel #17
0
 internal static extern IntPtr Core_CreateMValueRgba(IntPtr core, Rgba value);
Beispiel #18
0
		public CssColor(Rgba value)
			: base(NodeKind.Color)
		{
			this.value = value.ToString();
		}
Beispiel #19
0
        /// カプセル描画
        public void DrawCapsule( GraphicsContext graphics, GeometryCapsule trgCap, Camera cam, Rgba color )
        {
            if( debShader == null || trgCap.R <= 0.00001f ){
            return ;
            }

            /// 球体部分
            ///---------------------------------------------
            DrawSphere( graphics, new GeometrySphere( trgCap.StartPos, trgCap.R ), cam, color );
            DrawSphere( graphics, new GeometrySphere( trgCap.EndPos, trgCap.R ), cam, color );

            /// パイプ部分
            ///---------------------------------------------
            setCapsulePipeVertex( trgCap );

            debVb2.SetVertices( 0, debMesh2.Positions );
            debVb2.SetIndices( debMesh2.Indices );

            Matrix4 localMtx;
            if( trgCap.StartPos.X == trgCap.EndPos.X && trgCap.StartPos.Z == trgCap.EndPos.Z ){
            localMtx = Matrix4.LookAt( trgCap.EndPos, trgCap.StartPos, new Vector3(0.0f, 0.0f, 1.0f));
            }
            else{
            localMtx = Matrix4.LookAt( trgCap.EndPos, trgCap.StartPos, new Vector3(0.0f, 1.0f, 0.0f));
            }
            Matrix4 world = localMtx.Inverse() * Matrix4.Scale( new Vector3( trgCap.R, trgCap.R, trgCap.R ) );
            world.M41 = trgCap.StartPos.X;
            world.M42 = trgCap.StartPos.Y;
            world.M43 = trgCap.StartPos.Z;

            Matrix4 worldViewProj = cam.Projection * cam.View * world;

            // uniform value
            debShader.SetUniformValue( debUIdWVP, ref worldViewProj );

            Vector4 a_Color = new Vector4( (color.R / 255.0f), (color.G / 255.0f), (color.B / 255.0f), (color.A / 255.0f) );
            debShader.SetUniformValue( debShader.FindUniform( "IAmbient" ), ref a_Color );

            graphics.SetShaderProgram( debShader );

            graphics.SetVertexBuffer( 0, debVb2 );
            graphics.DrawArrays( debMesh2.Prim, 0, debMesh2.IndexCount );
        }
 public static Task SetNeonColorAsync(this IVehicle vehicle, Rgba neonColor) =>
 AltVAsync.Schedule(() => vehicle.NeonColor = neonColor);
 public static Task SetSecondaryColorRgbAsync(this IVehicle vehicle, Rgba secondaryColor) =>
 AltVAsync.Schedule(() => vehicle.SecondaryColorRgb = secondaryColor);
 public IVehicleBuilder NeonColor(Rgba value)
 {
     Add(ptr => AltNative.Vehicle.Vehicle_SetNeonColor(ptr, value));
     return(this);
 }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="input"></param>
        public override void Parse( Stream input )
        {
            BinaryReader br = new BinaryReader( input );

            _MatrixX = br.ReadByte();
            _MatrixY = br.ReadByte();
            _DivisorFLOAT = br.ReadUInt32();
            _BiasFLOAT = br.ReadUInt32();
            _MatrixValues = new List<uint>();
            for ( int i = 0; i < ( _MatrixX * _MatrixY ); i++ )
            {
                UInt32 a = br.ReadUInt32();
                _MatrixValues.Add( a );
            }
            _DefaultColor = new Rgba( this.Version );
            _DefaultColor.Parse( input );
            BitStream bits = new BitStream( input );

            uint reserved = bits.GetBits( 6 );
            if ( 0 != reserved )
            {
                throw new SwfFormatException( "ConvolutionFilter uses reserved bits" );
            }

            _Clamp = ( 0 != bits.GetBits( 1 ) );
            _PreserveAlpha = ( 0 != bits.GetBits( 1 ) );
        }
 public IVehicleBuilder SecondaryColorRgb(Rgba value)
 {
     Add(ptr => AltNative.Vehicle.Vehicle_SetSecondaryColorRGB(ptr, value));
     return(this);
 }
Beispiel #25
0
        /// private メソッド
        ///---------------------------------------------------------------------------
        /// 描画
        private void drawMesh( GraphicsContext graphics, Camera cam, Rgba color )
        {
            Matrix4 world = Matrix4.Translation( new Vector3( 0, 0, 0 ) );
            Matrix4 worldViewProj = cam.Projection * cam.View * world;

            // uniform value
            debShader.SetUniformValue( debUIdWVP, ref worldViewProj );

            Vector4 a_Color = new Vector4( (color.R / 255.0f), (color.G / 255.0f), (color.B / 255.0f), (color.A / 255.0f) );
            debShader.SetUniformValue( debShader.FindUniform( "IAmbient" ), ref a_Color );

            graphics.SetShaderProgram( debShader );

            graphics.SetVertexBuffer( 0, debVb );
            graphics.DrawArrays( debMesh.Prim, 0, debMesh.IndexCount );
        }
 public IVehicleBuilder TireSmokeColor(Rgba value)
 {
     Add(ptr => AltNative.Vehicle.Vehicle_SetTireSmokeColor(ptr, value));
     return(this);
 }
Beispiel #27
0
 internal static extern void Vehicle_GetTireSmokeColor(IntPtr vehicle, ref Rgba tireSmokeColor);
Beispiel #28
0
 public static string Format(Rgba rgba)
 {
     return($"{rgba.R / 255} {rgba.G / 255} {rgba.B / 255} {rgba.A}");
 }
Beispiel #29
0
 internal static extern void Vehicle_GetNeonColor(IntPtr vehicle, ref Rgba neonColor);
Beispiel #30
0
            public static void ConstructCachedUi()
            {
                _instance._cachedContainer = Container(_uiParent, "0 0 0 0.1", cFile.Ui.AnchorMin, cFile.Ui.AnchorMax);

                Element("Title_Element", _uiParent, ref _instance._cachedContainer, new Anchor(0.2f, 0f), new Anchor(0.75f, 1f), Rgba.Format(cFile.Ui.PrimaryColor));

                Element("Title_Padded", "Title_Element", ref _instance._cachedContainer, new Anchor(0.05f, 0.05f), new Anchor(0.95f, 0.95f), "0 0 0 0");

                Text("Title_Text", "Title_Padded", ref _instance._cachedContainer, TextAnchor.MiddleLeft, Rgba.Format(cFile.Ui.TextColor), 15, _instance.Lang("Ui_Title"), new Anchor(0f, 0f),
                     new Anchor(1f, 1f), "robotocondensed-bold.ttf");

                Element("Icon_Element", _uiParent, ref _instance._cachedContainer, new Anchor(0f, 0f), new Anchor(0.2f, 1f), Rgba.Format(cFile.Ui.PrimaryColor));

                Element("Icon_Padded", "Icon_Element", ref _instance._cachedContainer, new Anchor(0.2f, 0.15f), new Anchor(0.8f, 0.85f), "0 0 0 0");

                Image("Icon_Image", "Icon_Padded", ref _instance._cachedContainer, new Anchor(0f, 0f), new Anchor(1f, 1f), "http://i.imgur.com/jDo2bgn.png", Rgba.Format(cFile.Ui.DarkColor));
            }
Beispiel #31
0
 internal static extern IntPtr Server_CreateCheckpoint(IntPtr serverPointer, IntPtr playerTargetPointer,
                                                       byte type, Position pos, float radius, float height, Rgba color);
Beispiel #32
0
            public static CuiElementContainer ConstructTimer(DateTime time, float minutes)
            {
                var container = Container(_timerParent, Rgba.Format(cFile.Ui.DarkColor), new Anchor(0.75f, 0f), new Anchor(1, 1f), _uiParent);

                Text("Timer_Time", _timerParent, ref container, TextAnchor.MiddleCenter, Rgba.Format(cFile.Ui.TextColor), 15,
                     _instance.GetFormattedTime((time.AddMinutes(minutes) - DateTime.UtcNow).TotalSeconds),
                     new Anchor(0.05f, 0.05f), new Anchor(0.95f, 0.95f));

                return(container);
            }
Beispiel #33
0
 /// <summary>
 /// Creates a checkpoint for a specific player, with given type, position, radius, height and color.
 /// </summary>
 /// <param name="player">The player for which the checkpoint is created.</param>
 /// <param name="type">The type of the checkpoint.</param>
 /// <param name="pos">The position of the checkpoint.</param>
 /// <param name="radius">The size of the checkpoint.</param>
 /// <param name="height">The height of the checkpoint.</param>
 /// <param name="color">The color of the checkpoint.</param>
 /// <returns>The created Checkpoint.</returns>
 public static ICheckpoint CreateCheckpoint(IPlayer player, byte type, Position pos, float radius, float height,
                                            Rgba color) =>
 Module.Server.CreateCheckpoint(player, type, pos, radius, height, color);
Beispiel #34
0
 public SolidColorBrush(Rgba <float> color) : base(SolidColorBrushType.Instance())
 {
     _brushData = Inject(new DataBuffer());
     _brushData.Data(color.Data, Gl.StaticDraw);
 }
 public static Task SetTireSmokeColorAsync(this IVehicle vehicle, Rgba tireSmokeColor) =>
 AltVAsync.Schedule(() => vehicle.TireSmokeColor = tireSmokeColor);
Beispiel #36
0
 public void SetColor(Rgba <float> color) => _brushData.DataSection(0, color.Data);
 public static Task SetPrimaryColorRgbAsync(this IVehicle vehicle, Rgba primaryColor) =>
 AltVAsync.Schedule(() => vehicle.PrimaryColorRgb = primaryColor);
Beispiel #38
0
 public void GetRgba(ref Rgba rgba)
 {
     AltNative.MValueNative.MValueConst_GetRGBA(nativePointer, ref rgba);
 }
Beispiel #39
0
 public static Task SetRouteColorAsync(this IBlip blip, Rgba color) =>
 AltVAsync.Schedule(() => blip.RouteColor = color);
Beispiel #40
0
 public void CreateMValueRgba(out MValueConst mValue, Rgba value)
 {
     mValue = new MValueConst(MValueConst.Type.Entity,
                              AltNative.Server.Core_CreateMValueRgba(NativePointer, value));
 }
        /// グリッドのメッシュ
        public static MeshData CreateGrid(
                                      float width,   ///< 横幅
                                      float depth,   ///< 奥行き
                                      int divW,      ///< 横幅の分割数
                                      int divD,      ///< 奥行きの分割数
                                      Rgba colorG,   ///< グリッドの線の色
                                      Rgba colorW,  ///< 中心の線の色(x軸方向)
                                      Rgba colorD   ///< 中心の線の色(z軸方向)
                                      )
        {
            int lineNum = (divW + divD + 2);	// ラインの本数
            int vtxNum	= 2 * lineNum;				// 頂点数

            MeshData mesh = new MeshData( DrawMode.Lines, vtxNum, vtxNum );

            float mx = -(width / 2.0f);
            float mz = -(depth / 2.0f);

            float xstep	= (width / divW);
            float zstep	= (depth / divD);

            int i;
            int idx;
            float x = mx;
            // -xから始まって xを増やしながらz方向に線を引く
            for(i = 0; i < (divW+1); i++){
            idx = i*2;
            mesh.Positions[ (idx * 3) + 0 ] = x;
            mesh.Positions[ (idx * 3) + 1 ] = 0.0f;
            mesh.Positions[ (idx * 3) + 2 ] = -mz;

            mesh.Positions[ ((idx+1) * 3) + 0 ] = x;
            mesh.Positions[ ((idx+1) * 3) + 1 ] = 0.0f;
            mesh.Positions[ ((idx+1) * 3) + 2 ] = mz;
            x += xstep;
            }

            // -zから始まって zを増やしながらx方向に線を引く
            float z = mz;
            for(; i < lineNum; i++){
            idx = i*2;
            mesh.Positions[ (idx * 3) + 0 ] = -mx;
            mesh.Positions[ (idx * 3) + 1 ] = 0.0f;
            mesh.Positions[ (idx * 3) + 2 ] = z;

            mesh.Positions[ ((idx+1) * 3) + 0 ] = mx;
            mesh.Positions[ ((idx+1) * 3) + 1 ] = 0.0f;
            mesh.Positions[ ((idx+1) * 3) + 2 ] = z;
            z += zstep;
            }

            for(i = 0; i < vtxNum; i++){
            mesh.Normals[ (i*3) + 0 ] = 0.0f;
            mesh.Normals[ (i*3) + 1 ] = 1.0f;
            mesh.Normals[ (i*3) + 2 ] = 0.0f;
            mesh.Colors[ (i*4) + 0 ] = colorG.R / 255.0f;
            mesh.Colors[ (i*4) + 1 ] = colorG.G / 255.0f;
            mesh.Colors[ (i*4) + 2 ] = colorG.B / 255.0f;
            mesh.Colors[ (i*4) + 3 ] = colorG.A / 255.0f;

            }

            // センター線の色を変える
            if( (divW & 1) == 0 && (divD & 1) == 0 ){
            mesh.Colors[ (divW*4) + 0 ] = colorW.R / 255.0f;
            mesh.Colors[ (divW*4) + 1 ] = colorW.G / 255.0f;
            mesh.Colors[ (divW*4) + 2 ] = colorW.B / 255.0f;
            mesh.Colors[ (divW*4) + 3 ] = colorW.A / 255.0f;

            mesh.Colors[ ((divW+1)*4) + 0 ] = colorW.R / 255.0f;
            mesh.Colors[ ((divW+1)*4) + 1 ] = colorW.G / 255.0f;
            mesh.Colors[ ((divW+1)*4) + 2 ] = colorW.B / 255.0f;
            mesh.Colors[ ((divW+1)*4) + 3 ] = colorW.A / 255.0f;

            int ofst = (divW + 1) * 2;
            mesh.Colors[ ((ofst + divD) * 4) + 0 ] = colorD.R / 255.0f;
            mesh.Colors[ ((ofst + divD) * 4) + 1 ] = colorD.G / 255.0f;
            mesh.Colors[ ((ofst + divD) * 4) + 2 ] = colorD.B / 255.0f;
            mesh.Colors[ ((ofst + divD) * 4)+ 3 ] = colorD.A / 255.0f;

            mesh.Colors[ ((ofst + divD + 1) * 4) + 0 ] = colorD.R / 255.0f;
            mesh.Colors[ ((ofst + divD + 1) * 4) + 1 ] = colorD.G / 255.0f;
            mesh.Colors[ ((ofst + divD + 1) * 4) + 2 ] = colorD.B / 255.0f;
            mesh.Colors[ ((ofst + divD + 1) * 4) + 3 ] = colorD.A / 255.0f;
            }

            for(i = 0; i < vtxNum; i++){
            mesh.Indices[ i ] = (ushort)i;
            }

            return mesh;
        }
Beispiel #42
0
 internal static extern void Vehicle_GetPrimaryColorRGB(IntPtr vehicle, ref Rgba primaryColor);
Beispiel #43
0
        public void arrange(bool normal = false)
        {
            HashSet<Color> palette = new HashSet<Color>();

            VectorInt3 min = new VectorInt3(9999, 9999, 9999);
            VectorInt3 max = new VectorInt3(-9999, -9999,-9999);

            for (int i = 0; i < this.datas.Count; ++i) {
                palette.Add (this.datas[i].color);

                VectorInt3 pos = this.datas [i].pos;

                min.x = Mathf.Min (pos.x, min.x);
                min.y = Mathf.Min (pos.y, min.y);
                min.z = Mathf.Min (pos.z, min.z);
                max.x = Mathf.Max (pos.x, max.x);
                max.y = Mathf.Max (pos.y, max.y);
                max.z = Mathf.Max (pos.z, max.z);

            }

            if (normal) {
                max = max - min;
                for (int i = 0; i < this.datas.Count; ++i) {
                    palette.Add (this.datas[i].color);

                    VectorInt3 pos = this.datas [i].pos;
                    this.datas [i].pos = pos - min;

                }
                min = new VectorInt3 (0, 0, 0);
            }

            this.main = new VoxelStruct.Main ();
            this.main.name = "MAIN";
            this.main.size = 0;

            this.size = new VoxelStruct.Size ();
            this.size.name = "SIZE";
            this.size.size = 12;
            this.size.chunks = 0;

            this.size.box = new VectorInt3 ();

            this.size.box.x = max.x - min.x +1;
            this.size.box.y = max.y - min.y +1;
            this.size.box.z = max.z - min.z +1;

            this.rgba = new VoxelStruct.Rgba ();

            int size = Mathf.Max (palette.Count, 256);
            this.rgba.palette = new VectorInt4[size];
            int n = 0;
            foreach (Color c in palette)
            {
                this.rgba.palette [n] = VoxelFormater.Color2Bytes (c);
                ++n;
            }

            this.rgba.size = this.rgba.palette.Length * 4;
            this.rgba.name = "RGBA";
            this.rgba.chunks = 0;

            this.version = 150;

            this.main.chunks = 52 + this.rgba.palette.Length *4 + this.datas.Count *4;
        }
Beispiel #44
0
 internal static extern void Vehicle_GetSecondaryColorRGB(IntPtr vehicle, ref Rgba secondaryColor);
Beispiel #45
0
        private void arrange(VoxelStruct st, bool normal = false)
        {
            vs_ = st;
            HashSet <Color> palette = new HashSet <Color>();

            VectorInt3 min = new VectorInt3(9999, 9999, 9999);
            VectorInt3 max = new VectorInt3(-9999, -9999, -9999);

            for (int i = 0; i < st.datas.Count; ++i)
            {
                palette.Add(st.datas[i].color);

                VectorInt3 pos = st.datas [i].pos;

                min.x = Mathf.Min(pos.x, min.x);
                min.y = Mathf.Min(pos.y, min.y);
                min.z = Mathf.Min(pos.z, min.z);
                max.x = Mathf.Max(pos.x, max.x);
                max.y = Mathf.Max(pos.y, max.y);
                max.z = Mathf.Max(pos.z, max.z);
            }

            if (normal)
            {
                max = max - min;
                for (int i = 0; i < st.datas.Count; ++i)
                {
                    palette.Add(st.datas[i].color);
                    var data = st.datas [i];
                    data.pos    -= min;
                    st.datas [i] = data;                   //.pos = pos - min;
                }
                min = new VectorInt3(0, 0, 0);
            }

            this.main      = new MagicaVoxel.Main();
            this.main.name = "MAIN";
            this.main.size = 0;


            this.size        = new MagicaVoxel.Size();
            this.size.name   = "SIZE";
            this.size.size   = 12;
            this.size.chunks = 0;

            this.size.box = new VectorInt3();


            this.size.box.x = max.x - min.x + 1;
            this.size.box.y = max.y - min.y + 1;
            this.size.box.z = max.z - min.z + 1;


            this.rgba = new MagicaVoxel.Rgba();

            int size = Mathf.Max(palette.Count, 256);

            this.rgba.palette = new VectorInt4[size];
            int n = 0;

            foreach (Color c in palette)
            {
                this.rgba.palette [n] = MagicaVoxelFormater.Color2Bytes(c);
                ++n;
            }



            this.rgba.size   = this.rgba.palette.Length * 4;
            this.rgba.name   = "RGBA";
            this.rgba.chunks = 0;

            this.version = 150;

            this.main.chunks = 52 + this.rgba.palette.Length * 4 + st.datas.Count * 4;
        }
Beispiel #46
0
        /// 三角形描画
        public void DrawTriangle( GraphicsContext graphics, GeometryTriangle trgTri, Camera cam, Rgba color )
        {
            if( debShader == null ){
            return ;
            }

            /// バーテクスの更新
            ///------------------------------------------------------------
            for( int i=0; i<3; i++ ){
            debMesh.Positions[ i*3+0 ] = trgTri.GetPos(i).X;
            debMesh.Positions[ i*3+1 ] = trgTri.GetPos(i).Y;
            debMesh.Positions[ i*3+2 ] = trgTri.GetPos(i).Z;

            debMesh.Normals[ i*3+0 ] = trgTri.Plane.Nor.X;
            debMesh.Normals[ i*3+1 ] = trgTri.Plane.Nor.Y;
            debMesh.Normals[ i*3+2 ] = trgTri.Plane.Nor.Z;
            }

            debVb.SetVertices( 0, debMesh.Positions );
            debVb.SetIndices( debMesh.Indices );

            drawMesh( graphics, cam, color );
        }