예제 #1
0
        public VertexOutput VS(VertexInput input)
        {
            VertexOutput output;

            if (MeshConstants.SkinningEnabled == 1)
            {
                GetSkinnedVertexData(ref input, SkinningBuffer[input.BoneIndex]);
            }

            VSSkinnedInstanced(
                input,
                out output.Position,
                out output.WorldPosition,
                out output.WorldNormal,
                out output.CloudUV,
                RenderItemConstantsVS.World,
                GlobalConstantsVS.ViewProjection,
                Global_LightingConstantsVS.CloudShadowMatrix,
                GlobalConstantsShared.TimeInSeconds);

            output.UV0 = input.UV0;
            output.UV1 = input.UV1;

            return(output);
        }
예제 #2
0
        public FragmentInput VS(VertexInput input)
        {
            FragmentInput output;

            output.SystemPosition = Mul(World, new Vector4(input.Position, -1, 1));
            return(output);
        }
예제 #3
0
        public PixelInput VS(VertexInput input)
        {
            PixelInput output;
            Vector4    worldPosition = Mul(World, new Vector4(input.Position, 1));
            Vector4    viewPosition  = Mul(View, worldPosition);

            output.Position = Mul(Projection, viewPosition);

            output.Position_WorldSpace = worldPosition.XYZ();

            Vector4 outNormal = Mul(InverseTransposeWorld, new Vector4(input.Normal, 1));

            output.Normal = Vector3.Normalize(outNormal.XYZ());

            output.TexCoord = input.TexCoord;

            output.LightPosition1 = Mul(World, new Vector4(input.Position, 1));
            output.LightPosition1 = Mul(LightViewProjection1, output.LightPosition1);

            output.LightPosition2 = Mul(World, new Vector4(input.Position, 1));
            output.LightPosition2 = Mul(LightViewProjection2, output.LightPosition2);

            output.LightPosition3 = Mul(World, new Vector4(input.Position, 1));
            output.LightPosition3 = Mul(LightViewProjection3, output.LightPosition3);

            output.FragDepth = output.Position.Z;
            return(output);
        }
예제 #4
0
        public FragmentInput VS(VertexInput input)
        {
            FragmentInput output;

            output.Position = Mul(ViewProjection, Mul(World, new Vector4(input.Position, 1)));
            return(output);
        }
예제 #5
0
        public static void VSSkinnedInstanced(
            VertexInput input,
            out Vector4 position,
            out Vector3 worldPosition,
            out Vector3 worldNormal,
            out Vector2 cloudUV,
            Matrix4x4 world,
            Matrix4x4 viewProjection,
            Matrix4x4 cloudShadowMatrix,
            float timeInSeconds)
        {
            VSSkinnedInstancedPositionOnly(
                input,
                out position,
                out worldPosition,
                world,
                viewProjection);

            worldNormal = TransformNormal(input.Normal, world);

            cloudUV = CloudHelpers.GetCloudUV(
                worldPosition,
                cloudShadowMatrix,
                timeInSeconds);
        }
예제 #6
0
 public static void GetSkinnedVertexData(
     ref VertexInput input,
     Matrix4x4 skinning)
 {
     input.Position = Vector3.Transform(input.Position, skinning);
     input.Normal   = TransformNormal(input.Normal, skinning);
 }
        public FragmentInput VS(VertexInput input)
        {
            FragmentInput output;
            Vector4       worldPosition = Mul(Model, new Vector4(input.Position, 1));
            Vector4       viewPosition  = Mul(View, worldPosition);
            Vector4       clipPosition  = Mul(Projection, viewPosition);

            output.SystemPosition = clipPosition;
            output.Color          = input.Color;

            // don't need normal matrix if only uniform scalings
            // http://www.lighthouse3d.com/tutorials/glsl-12-tutorial/the-normal-matrix/

            Vector4 normalModelSpace = Mul(Model, new Vector4(input.Normal, 0.0f));

            output.Normal   = normalModelSpace.XYZ();
            output.LightVec = new Vector4(DirectionalLight.Direction, 1.0f);

            Vector4 worldPositionLight = worldPosition;
            Vector4 lightClip          = Mul(DirectionalLight.ShadowMatrix, worldPositionLight);

            output.LightCoord = lightClip;

            return(output);
        }
예제 #8
0
        public FragmentInput VS(VertexInput input)
        {
            FragmentInput output;

            output.Position = new Vector4(input.Position, 1);
            return(output);
        }
예제 #9
0
        /// <summary>
        /// Constructor
        /// </summary>

        public CentralizedProgressChannel(Stage <Runtime.Progress.ProgressUpdateCentralizer, Pointstamp> consumer,
                                          StageOutput <Int64, Pointstamp> stream, StageInput <Int64, Pointstamp> recvPort,
                                          InternalController controller,
                                          int channelId)
        {
            this.consumer = consumer;

            this.sendBundle = stream;   // producer.Output;
            this.recvBundle = recvPort; // consumer.Input;

            this.postboxes = new Dictionary <int, Fiber>();

            this.channelID = channelId;

            // Get the shard id and process id of the single consumer
            var consumerShardId   = consumer.Placement.Single().VertexId;
            var consumerProcessId = consumer.Placement.Single().ProcessId;

            var graphManager = sendBundle.ForStage.InternalGraphManager;

            if (debug)
            {
                Console.Error.WriteLine("  IncastChannel create ProcessId = {0}", graphManager.Controller.Configuration.ProcessID);
            }

            var myProcessId = graphManager.Controller.Configuration.ProcessID;

            if (myProcessId == consumerProcessId)
            {
                if (debug)
                {
                    Console.Error.WriteLine("  IncastChannel creating receive mailbox");
                }
                VertexInput <Int64, Pointstamp> recvFiber = this.recvBundle.GetPin(consumerProcessId);

                this.mailbox = new Mailbox(recvFiber.Vertex.Scheduler.State(graphManager).PostOffice,
                                           consumer.GetShard(consumerShardId), this.channelID, consumerShardId);
                recvFiber.Vertex.Scheduler.State(graphManager).PostOffice.RegisterMailbox(this.mailbox);
                if (controller.NetworkChannel != null)
                {
                    controller.NetworkChannel.RegisterMailbox(this.mailbox);
                }
            }

            foreach (VertexLocation loc in sendBundle.ForStage.Placement)
            {
                if (loc.ProcessId == sendBundle.ForStage.InternalGraphManager.Controller.Configuration.ProcessID)
                {
                    if (debug)
                    {
                        Console.Error.WriteLine("  IncastChannel loc = {0}/{1}/{2}", loc.ProcessId, loc.VertexId, loc.ThreadId);
                    }
                    var postbox = new Fiber(this.channelID, loc.VertexId, this.sendBundle.GetFiber(loc.VertexId),
                                            this.mailbox, controller, consumerShardId, consumerProcessId);
                    this.postboxes[loc.VertexId] = postbox;
                }
            }
            Logging.Info("Allocated incast channel [{0}]: {1} -> {2}", this.channelID, sendBundle, recvBundle);
        }
예제 #10
0
        public FragmentInput VS(VertexInput input)
        {
            FragmentInput output;

            output.Position    = Mul(ViewProjection, Mul(WorldAndInverse.World, new Vector4(input.Position, 1)));
            output.Position.Y += input.TexCoord.Y * .0001f;
            return(output);
        }
        public FragmentInput VS(VertexInput input)
        {
            FragmentInput output;

            output.Position           = new Vector4(input.Position, 0, 1);
            output.TextureCoordinates = input.TextureCoordinates;
            return(output);
        }
        public FragmentInput VS(VertexInput input)
        {
            FragmentInput output;

            output.Position  = new Vector4(input.Position.X, input.Position.Y, 0, 1);
            output.TexCoords = input.TexCoords;
            return(output);
        }
예제 #13
0
        FragmentInput VertexShaderFunc(VertexInput input)
        {
            FragmentInput output;

            output.Position = new Vector4(input.Position, 1);
            output.Color    = input.Color;
            return(output);
        }
예제 #14
0
 public PixelInput VertexFunc(VertexInput input)
 {
     return(new PixelInput()
     {
         Position = Mul(input.Position, cbObject.Wvp),
         UV = input.UV,
     });
 }
예제 #15
0
 public LocalMailbox(PostOffice postOffice, VertexInput <S, T> endpoint, int id, int shardId)
 {
     this.postOffice = postOffice;
     this.dirty      = false;
     this.endpoint   = endpoint;
     this.id         = id;
     this.shardId    = shardId;
     this.graphId    = endpoint.Vertex.Stage.InternalGraphManager.Index;
 }
예제 #16
0
 public LocalMailbox(PostOffice postOffice, VertexInput <S, T> endpoint, int id, int vertexId)
 {
     this.postOffice = postOffice;
     this.dirty      = false;
     this.endpoint   = endpoint;
     this.id         = id;
     this.vertexId   = vertexId;
     this.graphId    = endpoint.Vertex.Stage.InternalComputation.Index;
 }
예제 #17
0
        public FragmentInput VS(VertexInput input)
        {
            FragmentInput output;

            output.UV             = input.TexCoords;
            output.frColor        = input.Color;
            output.SystemPosition = Mul(World, new Vector4(input.Position, -1, 1));
            return(output);
        }
예제 #18
0
        public FragmentInput VS(VertexInput input)
        {
            FragmentInput output;

            output.Position           = ShaderBuiltins.Mul(Wvp, new Vector4(input.Position, 1));
            output.Color              = input.Color;
            output.TextureCoordinates = input.TextureCoordinates;
            return(output);
        }
예제 #19
0
        public FragmentInput VS(VertexInput input)
        {
            FragmentInput output;

            output.SystemPosition = new Vector4(input.Position.X, input.Position.Y, 0, 1);
            output.Color          = input.Color;

            return(output);
        }
예제 #20
0
 public static MeshStressResult GenerateMeshResult(VertexInput beamVertex, List <VertexStressResult> vertexResults)
 {
     return(new MeshStressResult
     {
         BarId = beamVertex.BarId,
         MeshId = beamVertex.MeshId,
         VertexResults = vertexResults,
     });
 }
예제 #21
0
        public PixelInput VS(VertexInput input)
        {
            PixelInput output;

            output.Position = Vector4.Transform(new Vector4(input.Position, 1), Projection);
            output.UV       = input.UV;
            output.Color    = input.Color;

            return(output);
        }
예제 #22
0
        public FragmentInput VS(VertexInput input)
        {
            FragmentInput output;
            Vector4       worldPosition = Mul(Model, new Vector4(input.Position, 1));
            Vector4       viewPosition  = Mul(View, worldPosition);
            Vector4       clipPosition  = Mul(Projection, viewPosition);

            output.SystemPosition = clipPosition;

            return(output);
        }
예제 #23
0
        public FragmentInput VS(VertexInput input)
        {
            FragmentInput output;

            Vector4 modelViewPosition = Mul(ModelView, new Vector4(input.Position, 1));

            output.SystemPosition = Mul(Projection, modelViewPosition);
            output.Color          = input.Color;

            //output.SystemPosition = output.SystemPosition / 4;
            return(output);
        }
예제 #24
0
        public LegacyLocalMailbox(PostOffice postOffice, VertexInput <S, T> endpoint, int id, int shardId)
            : base(postOffice, endpoint, id, shardId)
        {
            this.sharedQueue           = new ConcurrentQueue <Message <Pair <S, T> > >();
            this.sharedSerializedQueue = new ConcurrentQueue <SerializedMessage>();
            this.privateQueue          = new Queue <Message <Pair <S, T> > >();

            this.messagesFromLocalShards = new Message <Pair <S, T> > [this.postOffice.Controller.Workers.Count];
            for (int i = 0; i < this.postOffice.Controller.Workers.Count; ++i)
            {
                this.messagesFromLocalShards[i] = new Message <Pair <S, T> >(ThreadLocalBufferPools <Pair <S, T> > .pool.Value.Empty);
            }
        }
예제 #25
0
        public static void VSSkinnedInstancedPositionOnly(
            VertexInput input,
            out Vector4 position,
            out Vector3 worldPosition,
            Matrix4x4 world,
            Matrix4x4 viewProjection)
        {
            var worldPositionHomogeneous = Vector4.Transform(input.Position, world);

            position = Vector4.Transform(worldPositionHomogeneous, viewProjection);

            worldPosition = worldPositionHomogeneous.XYZ();
        }
예제 #26
0
        public FragmentInput VS(VertexInput input)
        {
            SN.Vector4 worldPos  = SMath.Mul(World, new SN.Vector4(input.Position, 1));
            SN.Vector4 worldNorm = SMath.Mul(World, new SN.Vector4(input.Normal, 0));

            FragmentInput output;

            output.SystemPosition = SMath.Mul(WorldViewProjection, new SN.Vector4(input.Position, 1));
            output.PositionWS     = new SN.Vector3(worldPos.X, worldPos.Y, worldPos.Z);
            output.NormalWS       = new SN.Vector3(worldNorm.X, worldNorm.Y, worldNorm.Z);
            output.TexCoords      = input.TexCoords;

            return(output);
        }
        /// <summary>
        /// Constructor
        /// </summary>
        public CentralizedProgressChannel(Stage <ProgressUpdateCentralizer, Empty> consumer,
                                          StageOutput <Update, Empty> stream, StageInput <Update, Empty> recvPort,
                                          InternalController controller,
                                          int channelId)
        {
            this.consumer = consumer;

            this.sendBundle = stream;   // producer.Output;
            this.recvBundle = recvPort; // consumer.Input;

            this.postboxes = new Dictionary <int, Fiber>();

            this.channelID = channelId;

            // Get the vertex id and process id of the single consumer
            var consumerVertexId  = consumer.Placement.Single().VertexId;
            var consumerProcessId = consumer.Placement.Single().ProcessId;

            var computation = sendBundle.ForStage.InternalComputation;

            var myProcessId = computation.Controller.Configuration.ProcessID;

            if (myProcessId == consumerProcessId)
            {
                VertexInput <Update, Empty> recvFiber = this.recvBundle.GetPin(consumerProcessId);

                this.mailbox = new Mailbox(recvFiber.Vertex.Scheduler.State(computation).PostOffice,
                                           consumer.GetVertex(consumerVertexId), this.channelID, consumerVertexId);

                //recvFiber.Vertex.Scheduler.State(computation).PostOffice.RegisterMailbox(this.mailbox);

                if (controller.NetworkChannel != null)
                {
                    controller.NetworkChannel.RegisterMailbox(this.mailbox);
                }
            }

            foreach (VertexLocation loc in sendBundle.ForStage.Placement)
            {
                if (loc.ProcessId == sendBundle.ForStage.InternalComputation.Controller.Configuration.ProcessID)
                {
                    var postbox = new Fiber(this.channelID, loc.VertexId, this.sendBundle.GetFiber(loc.VertexId),
                                            this.mailbox, controller, consumerVertexId, consumerProcessId);
                    this.postboxes[loc.VertexId] = postbox;
                }
            }
            Logging.Info("Allocated CentralizedProgressChannel [{0}]: {1} -> {2}", this.channelID, sendBundle, recvBundle);
            NaiadTracing.Trace.ChannelInfo(ChannelId, SourceStage.StageId, DestinationStage.StageId, true, true);
        }
예제 #28
0
        public FragmentInput VS(VertexInput input)
        {
            FragmentInput output;

            Vector4 p = ShaderBuiltins.Mul(XformView, new Vector4(input.Position, 1));
            Vector4 n = ShaderBuiltins.Mul(XformView, new Vector4(input.Normal, 0));

            output.RelativePosition = p.XYZ();
            output.RelativeNormal   = ShaderBuiltins.Sqrt(n.XYZ());

            output.Projected = ShaderBuiltins.Mul(XformProj, p);

            output.Color = input.Color;
            return(output);
        }
예제 #29
0
        public LegacyLocalMailbox(PostOffice postOffice, VertexInput <S, T> endpoint, int id, int vertexId)
            : base(postOffice, endpoint, id, vertexId)
        {
            this.sharedQueue           = new ConcurrentQueue <Message <S, T> >();
            this.sharedSerializedQueue = new ConcurrentQueue <SerializedMessage>();
            this.privateQueue          = new Queue <Message <S, T> >();

            this.messagesFromLocalVertices = new Message <S, T> [this.postOffice.Controller.Workers.Count];
            for (int i = 0; i < this.postOffice.Controller.Workers.Count; ++i)
            {
                this.messagesFromLocalVertices[i] = new Message <S, T>();
            }

            this.decoder = new AutoSerializedMessageDecoder <S, T>(endpoint.Vertex.SerializationFormat);
        }
        public FragmentInput VS(VertexInput input)
        {
            FragmentInput output;

            output.Color = input.Color;

            output.Position = Vector4.Transform(
                Vector4.Transform(
                    Vector4.Transform(
                        new Vector4(input.Position.X, input.Position.Y, 0.0f, 1f),
                        Model),
                    View),
                Projection);

            return(output);
        }