public override void OnCreateSystem(ECSWorld world)
 {
     cameraQuery = new ComponentQuery();
     cameraQuery.IncludeShared <Camera>();
     cameraQuery.IncludeReadonly <Position>();
     cameraQuery.IncludeReadonly <Rotation>();
 }
 public override ComponentQuery GetQuery()
 {
     posScaleQuery.IncludeReadonly <Position>();
     posScaleQuery.Exclude <Rotation>();
     posScaleQuery.IncludeReadonly <Scale>();
     posScaleQuery.IncludeReadWrite <ObjectToWorld>();
     return(posScaleQuery);
 }
Exemple #3
0
        public override ComponentQuery GetQuery()
        {
            var query = new ComponentQuery();

            query.IncludeReadonly <Position>();
            query.IncludeReadonly <Rotation>();
            query.IncludeReadWrite <PhysicsBodyLockedValues>();
            query.IncludeReadonly <PhysicsBodyLockAxis>();
            return(query);
        }
Exemple #4
0
        public override ComponentQuery GetQuery()
        {
            ComponentQuery query = new ComponentQuery();

            query.IncludeReadonly <Player>();
            query.IncludeReadonly <Rotation>();
            query.IncludeReadWrite <Velocity>();
            query.IncludeReadWrite <AngularVelocity>();
            return(query);
        }
        public override ComponentQuery GetQuery()
        {
            ComponentQuery query = new ComponentQuery();

            query.IncludeReadWrite <RigidBody>();
            query.IncludeReadWrite <Position>();
            query.IncludeReadWrite <Rotation>();
            query.IncludeReadonly <Velocity>();
            query.IncludeReadonly <AngularVelocity>();
            return(query);
        }
Exemple #6
0
        public override ComponentQuery GetQuery()
        {
            ComponentQuery query = new ComponentQuery();

            query.IncludeReadonly <StaticRigidBody>();
            query.IncludeReadWrite <InternalColliderHandle>();
            query.IncludeReadonly <Position>();
            query.IncludeReadonly <Rotation>();
            query.Exclude <InternalStaticBodyHandle>();
            query.Exclude <RigidBody>();
            return(query);
        }
        public override ComponentQuery GetQuery()
        {
            ComponentQuery query = new ComponentQuery();

            query.IncludeReadonly <Asteroid>();
            return(query);
        }
        public override ComponentQuery GetQuery()
        {
            ComponentQuery query = new ComponentQuery();

            query.IncludeReadonly <BoundingBox>();
            query.IncludeShared <CulledRenderTag>();
            return(query);
        }
Exemple #9
0
        public void OnCreateSystem(ECSWorld world)
        {
            //camera = new Camera() {
            //	aspect = (float)Window.window.Width / (float)Window.window.Height,
            //	farPlane = 10000,
            //	fow = 60,
            //	nearPlane = 0.1f
            //};

            //cameraPosition = new Vector3(4 , 10, 20);
            //cameraRotation = MathHelper.LookAt(cameraPosition, Vector3.Zero, Vector3.UnitY);
            cameraQuery = new ComponentQuery();
            cameraQuery.IncludeShared <Camera>();
            cameraQuery.IncludeReadonly <Position>();
            cameraQuery.IncludeReadonly <Rotation>();

            foreach (var assembly in AssemblyHelper.GetAllUserAssemblies())
            {
                foreach (Type type in AssemblyHelper.GetTypesWithAttribute(assembly, typeof(RenderSystemAttribute)))
                {
                    try
                    {
                        if (!type.GetInterfaces().Contains(typeof(IRenderSystem)))
                        {
                            continue;
                        }

                        RenderSystemAttribute attribute =
                            type.GetCustomAttribute(typeof(RenderSystemAttribute)) as RenderSystemAttribute;
                        IRenderSystem instance = Activator.CreateInstance(type) as IRenderSystem;

                        RegisterRenderSystem(instance, type, attribute.renderStage, attribute.renderBefore,
                                             attribute.renderAfter);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine($"could not create an instance of type {type.Name}. Does it have an empty constructor? \n{ex.StackTrace}");
                    }
                }
            }

            foreach (var renderSystem in systems)
            {
                renderSystem.Value.OnCreate(world);
            }
        }
Exemple #10
0
        public override ComponentQuery GetQuery()
        {
            var query = new ComponentQuery();

            query.IncludeReadonly <CameraFollow>();
            query.IncludeReadWrite <Position>();
            return(query);
        }
Exemple #11
0
        public override ComponentQuery GetQuery()
        {
            ComponentQuery query = new ComponentQuery();

            query.IncludeReadonly <BoxCollider>();
            query.Exclude <InternalColliderHandle>();
            return(query);
        }
Exemple #12
0
        public override ComponentQuery GetQuery()
        {
            ComponentQuery query = new ComponentQuery();

            query.IncludeReadonly <InternalStaticBodyHandle>();
            query.Exclude <StaticRigidBody>();
            return(query);
        }
Exemple #13
0
            public override ComponentQuery GetQuery()
            {
                ComponentQuery query = new ComponentQuery();

                query.IncludeReadWrite <Rotation>();
                query.IncludeReadonly <RotateComponent>();
                return(query);
            }
        public override ComponentQuery GetQuery()
        {
            ComponentQuery query = new ComponentQuery();

            query.IncludeReadWrite <BoundingBox>();
            query.IncludeReadonly <ObjectToWorld>();
            query.IncludeShared <MeshRenderer>();
            return(query);
        }
Exemple #15
0
        public override ComponentQuery GetQuery()
        {
            var query = new ComponentQuery();

            query.IncludeShared <Camera>();
            query.IncludeReadWrite <Position>();
            query.IncludeReadWrite <Rotation>();
            query.IncludeReadonly <CameraFlightComponent>();
            return(query);
        }
        public void OnCreate(ECSWorld world)
        {
            query.IncludeReadonly <ObjectToWorld>();
            query.IncludeShared <DebugMeshConvexHullRenderer>();
            query.ExcludeShared <CulledRenderTag>();

            var fragShader = Asset.Load <ShaderAsset>("mesh_instanced_default.frag");
            var vertShader = Asset.Load <ShaderAsset>("mesh_instanced_default.vert");
            var shader     = new ShaderPipeline(fragShader, vertShader, ShaderType.Instanced);

            defaultShader = shader.ShaderPair;

            defaultMaterial = new Material(GraphicsContext.graphicsDevice,
                                           GraphicsContext.uniform0, defaultShader);
            defaultMaterial.wireframe = true;

            instanceMatricesBuffers = new List <DeviceBuffer>(1);
            GrowInstanceMatrices();
        }