示例#1
0
        /// <nodoc />
        public PredefinedTypes(PrimitiveTypes knownTypes)
        {
            Contract.Requires(knownTypes != null);

            AllAmbientDefinitions = new Dictionary <Type, AmbientDefinitionBase>
            {
                [typeof(ArrayLiteral)]      = AmbientArray = new AmbientArray(knownTypes),
                [typeof(DirectoryArtifact)] = m_ambientDirectory = new AmbientDirectory(knownTypes),
                [typeof(EnumValue)]         = m_ambientEnum = new AmbientEnum(knownTypes),
                [typeof(FileArtifact)]      = m_ambientFile = new AmbientFile(knownTypes),
                [typeof(ObjectLiteral)]     = AmbientObject = new AmbientObject(knownTypes),
                [typeof(ObjectLiteral0)]    = AmbientObject,
                [typeof(ObjectLiteralSlim)] = AmbientObject,
                [typeof(ObjectLiteralN)]    = AmbientObject,
                [typeof(AbsolutePath)]      = m_ambientPath = new AmbientPath(knownTypes),
                [typeof(StaticDirectory)]   = m_ambientStaticDirectory = new AmbientStaticDirectory(knownTypes),
                [typeof(string)]            = m_ambientString = new AmbientString(knownTypes),
                [typeof(AmbientStringBuilder.StringBuilderWrapper)] = m_ambientStringBuilder = new AmbientStringBuilder(knownTypes),
                [typeof(int)]          = m_ambientNumber = new AmbientNumber(knownTypes),
                [typeof(UnitValue)]    = m_ambientUnit = new AmbientUnit(knownTypes),
                [typeof(bool)]         = m_ambientBoolean = new AmbientBoolean(knownTypes),
                [typeof(OrderedMap)]   = m_ambientMap = new AmbientMap(knownTypes),
                [typeof(OrderedSet)]   = m_ambientSet = new AmbientSet(knownTypes),
                [typeof(MutableSet)]   = m_ambientMutableSet = new AmbientMutableSet(knownTypes),
                [typeof(PathAtom)]     = m_ambientPathAtom = new AmbientPathAtom(knownTypes),
                [typeof(RelativePath)] = m_ambientRelativePath = new AmbientRelativePath(knownTypes),

                // the ones below don't define any 'instance' methods, thus are not associated with a "real" object type,
                // i.e., a type that is going to be encountered during a DScript evaluation.
                [typeof(Dummy)] = m_ambientContext = new AmbientContext(knownTypes),
                [typeof(Dummy)] = m_ambientDebug = new AmbientDebug(knownTypes),
                [typeof(Dummy)] = m_ambientContract = new AmbientContract(knownTypes),
                [typeof(Dummy)] = m_ambientGlobal = new AmbientGlobal(knownTypes),
                [typeof(Dummy)] = m_ambientMath = new AmbientMath(knownTypes),
                [typeof(Dummy)] = m_ambientTransformerOriginal = new AmbientTransformerOriginal(knownTypes),
                [typeof(Dummy)] = m_ambientTransformerHack = new AmbientTransformerHack(knownTypes),
                [typeof(Dummy)] = m_ambientEnvironment = new AmbientEnvironment(knownTypes),
                [typeof(Dummy)] = m_ambientArgumentKind = new AmbientArgumentKind(knownTypes),
                [typeof(Dummy)] = m_ambientArtifactKind = new AmbientArtifactKind(knownTypes),
                [typeof(Dummy)] = m_ambientTextEncoding = new AmbientTextEncoding(knownTypes),
                [typeof(Dummy)] = m_ambientNameResolutionSemantics = new AmbientNameResolutionSemantics(knownTypes),
                [typeof(Dummy)] = m_ambientKeyForm = new AmbientKeyForm(knownTypes),
                [typeof(Dummy)] = m_ambientSealSourceDirectoryOption = new AmbientSealSourceDirectoryOption(knownTypes),
                [typeof(Dummy)] = m_ambientHashHelper = new AmbientHashing(knownTypes),
                [typeof(Dummy)] = m_ambientValueCacheHelper = new AmbientValueCache(knownTypes),
                [typeof(Dummy)] = m_ambientJsonHelper = new AmbientJson(knownTypes),
                [typeof(Dummy)] = m_ambientXmlHelper = new AmbientXml(knownTypes),
                [typeof(Dummy)] = m_ambientContainerIsolationLevel = new AmbientContainerIsolationLevel(knownTypes),
                [typeof(Dummy)] = m_ambientUnsafe = new AmbientUnsafe(knownTypes),
            };
        }
示例#2
0
        public static void draw()
        {
            // Prepare shaders
            Standard.Effects.prepare();

            // Build visible sectors if they have been invalidated
            for (int i = 0; i < Frame.sectorCount; ++i)
            {
                Frame.sectors[i].prepare();
            }

            // Render everything opaque
            m_device.BlendState = BlendState.Opaque;

            // Prepare ambient map
            if (Settings.Default.ambient_enabled)
            {
                AmbientMap.prepare();
            }

            // Set render states on the device
            m_device.DepthStencilState = DepthStencilState.Default;
            if (Game1.instance.wireframe)
            {
                m_device.RasterizerState = new RasterizerState {
                    FillMode = FillMode.WireFrame
                }
            }
            ;
            else
            {
                m_device.RasterizerState = RasterizerState.CullCounterClockwise;
            }

            // Draw the walls first
            drawWalls();

            // Draw the floors and ceilings
            drawFlats();

            // We have nothing to gain in culling sprites. We will use this to swap them!
            m_device.RasterizerState = RasterizerState.CullNone;

            // Draw the sprites
            drawSprites();

            // Draw gun
            drawGun();
        }
示例#3
0
        public static void draw()
        {
            // Prepare shaders
            Deferred.Effects.prepare();

            // Build visible sectors if they have been invalidated
            foreach (r_local.sector_t sector in p_setup.sectors)
            {
                sector.prepare();
            }

            // Render everything opaque
            m_device.BlendState = BlendState.Opaque;

            // Prepare ambient map, and render invalidated sectors to it
            if (Settings.Default.ambient_enabled)
            {
                AmbientMap.prepare();
            }

            // Set render states on the device
            m_device.DepthStencilState = DepthStencilState.Default;
            if (Game1.instance.wireframe)
            {
                m_device.RasterizerState = new RasterizerState {
                    FillMode = FillMode.WireFrame
                }
            }
            ;
            else
            {
                m_device.RasterizerState = RasterizerState.CullCounterClockwise;
            }

            // Bind and clear the gbuffer
            Deferred.GBuffer.prepare();

            // Draw the walls first
            drawWalls();

            // Draw the floors and ceilings
            drawFlats();

            // Post process
            if (Settings.Default.postprocess_enabled)
            {
                // Bind frame buffer used for post process
                m_device.SetRenderTargets(null);
            }
            else
            {
                // We will render on the main frame buffer
                m_device.SetRenderTargets(null);
            }

            // Ambient pass
            drawAmbient();

            // Apply post process effects
            if (Settings.Default.postprocess_enabled)
            {
            }
        }