public void CreateBoundary(double radius, double density)
        {
            InnerBounds = new Box3d(-8, 8, 0, 10, -2, 2);
            OuterBounds = InnerBounds;

            int thickness = 1;

            OuterBounds.Min -= new Vector3d(radius * 2 * thickness);
            OuterBounds.Max += new Vector3d(radius * 2 * thickness);

            ParticleSource source = new ParticlesFromBounds(radius, OuterBounds, InnerBounds);

            Boundary = new FluidBoundary3d(source, radius, density, Matrix4x4d.Identity);

            BoundarySpheres = new GameObject[Boundary.NumParticles];
            float diam = (float)Boundary.ParticleDiameter;

            for (int i = 0; i < BoundarySpheres.Length; i++)
            {
                Vector3d pos = Boundary.Positions[i];

                GameObject sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere);

                sphere.SetActive(drawBoundary);
                sphere.transform.parent     = transform;
                sphere.transform.position   = new Vector3((float)pos.x, (float)pos.y, (float)pos.z);
                sphere.transform.localScale = new Vector3(diam, diam, diam);
                sphere.GetComponent <Collider>().enabled = false;

                sphere.GetComponent <MeshRenderer>().material = boundaryMaterial;

                BoundarySpheres[i] = sphere;
            }
        }
        internal FluidConstraint3dGPU(FluidBody3d body, FluidBoundary3d boundary) : base(body)
        {
            Iterations = 5;
            Boundary   = boundary;

            InitCurrentShader();

            body.Kernel.InitCubicKernel3dGPU(CurrentShader);

            InitConstShaderData();
        }
Beispiel #3
0
        public void CreateBoundary(float radius, float density)
        {
            InnerBounds = new Box3f(-8, 4, 0, 10, -2, 4);
            //new Box3f(-8, 8, 0, 10, -2, 4);
            OuterBounds = InnerBounds;

            float thickness = 1.2f;

            OuterBounds.Min -= new Vector3f(radius * 2 * thickness);
            OuterBounds.Max += new Vector3f(radius * 2 * thickness);

            ParticleSource source = new ParticlesFromBounds(radius, OuterBounds, InnerBounds);

            Boundary = new FluidBoundary3d(source, radius, density, Matrix4x4f.Identity);

            CreateBoundaryVisualize();
        }
 internal FluidConstraint3d(FluidBody3d body, FluidBoundary3d boundary) : base(body)
 {
     Iterations = 5;
     Boundary   = boundary;
 }