Inheritance: AcTools.Render.Forward.ForwardRenderer, IKn5ObjectRenderer
            internal CarSlot([NotNull] ForwardKn5ObjectRenderer renderer, [CanBeNull] CarDescription car, int?id)
            {
                Id = id ?? ++_id;

                _renderer  = renderer;
                _car       = car;
                CarWrapper = new RenderableList();
            }
Exemplo n.º 2
0
        public void BmwE92() {
            var path = Path.Combine(AcRootFinder.Find(), @"content\cars\bmw_m3_e92\bmw_m3_e92.kn5");
            if (!File.Exists(path)) {
                Debug.WriteLine("REQUIRED ASSET IS MISSING, TEST CANNOT BE DONE");
                return;
            }

            using (var renderer = new ForwardKn5ObjectRenderer(path)) {
                renderer.UseMsaa = false;
                renderer.UseFxaa = true;
                new LiteShowroomWrapper(renderer).Run();
            }
        }
Exemplo n.º 3
0
 public LiteShowroomWrapper(ForwardKn5ObjectRenderer renderer, string title = "Lite Showroom", int width = 1600, int height = 900) : base(renderer, title, width, height) {
     _renderer = renderer;
     Form.MouseDoubleClick += OnMouseDoubleClick;
 }
Exemplo n.º 4
0
        private static int MainInner(string[] args) {
            var options = new Options();
            if (!Parser.Default.ParseArguments(args, options)) return 1;

            var filename = Assembly.GetEntryAssembly().Location;
            if (options.Verbose || filename.IndexOf("log", StringComparison.OrdinalIgnoreCase) != -1
                    || filename.IndexOf("debug", StringComparison.OrdinalIgnoreCase) != -1) {
                var log = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location) ?? "", "Log.txt");
                try {
                    File.WriteAllBytes(log, new byte[0]);
                    RenderLogging.Initialize(log);
                } catch (Exception e) {
                    MessageBox.Show("Can’t setup logging: " + e, @"Oops!", MessageBoxButtons.OK);
                }
            }

            var inputItems = options.Items;
#if DEBUG
            inputItems = inputItems.Any() ? inputItems : new[] { DebugHelper.GetCarKn5(), DebugHelper.GetShowroomKn5() };
#endif

            if (inputItems.Count == 0) {
                var dialog = new OpenFileDialog {
                    Title = @"Select KN5",
                    Filter = @"KN5 Files (*.kn5)|*.kn5"
                };
                if (dialog.ShowDialog() != DialogResult.OK) return 2;

                inputItems = new[] { dialog.FileName };
            }

            var kn5File = inputItems.ElementAtOrDefault(0);
            if (kn5File == null || !File.Exists(kn5File)) {
                MessageBox.Show(@"File is missing", @"Custom Showroom", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return 3;
            }

            if (options.Mode == Mode.UpdateAmbientShadows) {
                UpdateAmbientShadows(kn5File);
                return 0;
            }

            if (options.Mode == Mode.ExtractUv) {
                if (string.IsNullOrWhiteSpace(options.ExtractUvTexture)) {
                    MessageBox.Show(@"Texture to extract is not specified", @"Custom Showroom", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return 4;
                }
                ExtractUv(kn5File, options.ExtractUvTexture);
                return 0;
            }

            var showroomKn5File = inputItems.ElementAtOrDefault(1);
            if (showroomKn5File == null && options.ShowroomId != null) {
                showroomKn5File = Path.Combine(
                        Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(kn5File))) ?? "",
                        "showroom", options.ShowroomId, options.ShowroomId + ".kn5");
            }

            if (!File.Exists(showroomKn5File)) {
                showroomKn5File = null;
            }
            
            if (options.Mode == Mode.Lite) {
                using (var renderer = new ForwardKn5ObjectRenderer(kn5File)) {
                    renderer.UseMsaa = options.UseMsaa;
                    renderer.UseFxaa = options.UseFxaa;
                    new LiteShowroomWrapper(renderer).Run();
                }
            } else {
                using (var renderer = new Kn5ObjectRenderer(kn5File, showroomKn5File)) {
                    renderer.UseFxaa = options.UseFxaa;
                    new FancyShowroomWrapper(renderer).Run();
                }
            }

            GC.Collect();
            GC.WaitForPendingFinalizers();
            return 0;
        }