Exemple #1
0
        public ModelRenderManager(BlockDataManager bdm, Model model)
        {
            _Model = model;

            _Parts = new RenderData <BlockRenderData> [model.Parts.Length][];
            Voxel.Model[] vmodel = new Voxel.Model[model.Parts.Length];
            for (int i = 0; i < model.Parts.Length; ++i)
            {
                vmodel[i]         = new Voxel.Model();
                vmodel[i].Palette = model.Palette;
                vmodel[i].SizeX   = model.SizeX;
                vmodel[i].SizeY   = model.SizeY;
                vmodel[i].SizeZ   = model.SizeZ;
                vmodel[i].Voxel   = model.Parts[i].Voxel;
            }

            for (int i = 0; i < model.Parts.Length; ++i)
            {
                var p = model.Parts[i];
                bdm.Clear();
                bdm.BeginData();
                Voxel.Model[] adj = null;
                if (p.AdjacentParts != null)
                {
                    adj = p.AdjacentParts.Select(ii => vmodel[ii]).ToArray();
                }
                var provider = new Voxel.ModelDataProvider(vmodel[i], adj);
                provider.Translation = new Vector4(p.Translation, 0);
                provider.FlushRenderData(bdm);
                _Parts[i] = bdm.EndData();
            }
        }
Exemple #2
0
    void Start()
    {
        // Load Manager Scripts
        playerDataManagerObj    = GameObject.Find("PlayerDataManager");
        playerDataManagerScript = playerDataManagerObj.GetComponent <PlayerDataManager>();
        blockManagerScript      = blockManagerObj.GetComponent <BlockManager>();
        blockDataManagerScript  = blockDataManagerObj.GetComponent <BlockDataManager>();
        touchManager            = GetComponent <CameraScript>();

        // Load GameObjects
        if (playerCamera == null)
        {
            playerCamera = Camera.main;
        }

        // Do Init
        prevSelectedPos = Vector3.zero;

        SetPopupGUI(Canvas);
        SetDataSaveGUI(Canvas);

        blockButton.onClick.AddListener(() => SelectMenu(blockButton));
        returnButton.onClick.AddListener(() => {
            playerDataManagerScript.SetPlayerState(SCENE_STATE.MY_SCENE);
            SceneManager.LoadScene("MyScene");
        });
    }
Exemple #3
0
    // Use this for initialization
    void Start()
    {
        if (playerCamera == null)
        {
            playerCamera = Camera.main;
        }

        indicator = Instantiate(indicator) as GameObject;
        blockDataManagerScript = blockDataManagerObj.GetComponent <BlockDataManager>();
    }
Exemple #4
0
        static void Main(string[] args)
        {
            var file = @"D:\Projekty\MSEW DB\471.pdf";

            var pdf = new TestPdfDataManager();

            var s = pdf.GetSinglePage(file, 10).Split('\n');

            var sa        = pdf.GetAllPages(file);
            var saSplited = sa.Split('\n');
            var list      = new[] { "PROJECT IDENTIFICATION",
                                    "SOIL DATA",
                                    "Geometry and Surcharge loads",
                                    "U N I F O R M   S U R C H A R G E",
                                    "OTHER EXTERNAL LOAD(S)",
                                    "ANALYSIS: CALCULATED FACTORS",
                                    "BEARING CAPACITY for GIVEN LAYOUT",
                                    "RESULTS for STRENGTH",
                                    "RESULTS for PULLOUT",
                                    "REINFORCED SOIL",
                                    "RETAINED SOIL",
                                    "FOUNDATION SOIL",
                                    "LATERAL EARTH PRESSURE COEFFICIENTS" };


            var projectList = new[] { "Title:",
                                      "Project Number:",
                                      "Designer:" };

            var globalFactors = new[] { "factored bearing load",
                                        "Bearing capacity, CDR =",
                                        "Factored bearing resistance",
                                        "Factored bearing load", };

            BlockDataManager block = new BlockDataManager();

            var dict = block.ResolveBlocks(sa, list);

            var e  = s.Where(x => list.Any(y => x.Contains(y)));
            var ed = list.Where(x => s.Any(y => y.Contains(x)));

            foreach (var ee in ed)
            {
                Console.Write(ee);
            }
            Console.WriteLine("------------------------------------------");

            foreach (var ee in s)
            {
                Console.WriteLine(ee);
            }

            var pull     = new LayersPulloutManager();
            var factors  = new LayersFactorsManager();
            var strength = new LayersStrengthManager();

            var layers = factors.Resolve(dict["ANALYSIS: CALCULATED FACTORS"]);

            layers = pull.Resolve(dict["RESULTS for PULLOUT"], layers);
            layers = strength.Resolve(dict["RESULTS for STRENGTH"], layers);

            var abc     = new ProjectDataManager();
            var abcList = abc.GetValidLines(dict["PROJECT IDENTIFICATION"]);

            var asas = new SoilDataManager();

            var rf = asas.Resolve(dict["REINFORCED SOIL"]);
            var ff = asas.Resolve(dict["FOUNDATION SOIL"]);
            var rs = asas.Resolve(dict["RETAINED SOIL"]);

            var dda = new WallGeometryManager();

            var sd = dda.Resolve(dict["Geometry and Surcharge loads"]);

            Console.ReadKey();
        }
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var rm = new RenderManager();

            rm.InitDevice(new Form1());

            var shaderFace = Shader <VertexConstData> .CreateFromString(rm, BlockShader.Code);

            shaderFace.CreateSamplerForPixelShader(0, new SamplerStateDescription
            {
                Filter   = Filter.MinMagMipLinear,
                AddressU = TextureAddressMode.Border,
                AddressV = TextureAddressMode.Border,
                AddressW = TextureAddressMode.Border,
            });

            var aotexture = new AmbientOcculsionTexture(rm);

            shaderFace.SetResourceForPixelShader(0, aotexture.ResourceView);

            var camera = new Camera(new Vector3(0, 0, 70));

            camera.SetForm(rm.Form);
            var proj = Matrix.PerspectiveFovLH((float)Math.PI / 4.0f, 800.0f / 600.0f, 0.1f, 1000.0f);

            //var model = ModelLoader.LoadModel("hiyori.model");
            var model = AnimationTest.CreateModel();
            //var segment = ModelLoader.LoadSegment("hiyori_walk.segment");
            var   segment        = AnimationTest.CreateSegment();
            var   animationFrame = new Frame(model.Parts.Length);
            float time           = 0;

            var bdm = new BlockDataManager(rm);

            bdm.SetLayoutFromShader(shaderFace);
            var renderer = new ModelRenderer(bdm, model)
            {
                Camera = camera,
                Proj   = proj,
                Shader = shaderFace,
            };

            var editor = new FormEditRotation(animationFrame);

            editor.Show();

            RenderLoopHelper.Run(rm, false, delegate(RenderContext frame)
            {
                //--- render world ---

                camera.Step();

                rm.ImmediateContext.ApplyShader(shaderFace);

                time += 0.1f;
                //segment.SetupFrame(animationFrame, time);
                lock (animationFrame)
                {
                    animationFrame.TransformModel(model);
                }

                renderer.Frame = frame;
                renderer.Render();

                //--- present ---

                frame.Present(true);
            });
        }
 public ModelRenderer(BlockDataManager bdm, Model m)
     : base(bdm, m)
 {
 }