コード例 #1
0
        public SkyInstance(Sky sky)
        {
            m_sky = sky;

            m_litEffect = new LitEffectInstance(sky.RenderPass);
            m_litEffect.AmbientLight = new AmbientLight(Vector3.Zero);
            m_litEffect.Light        = new DirectionalLight(Vector3.UnitY, Vector3.Zero);
            m_litEffect.Light2       = new DirectionalLight(Vector3.UnitY, Vector3.Zero);

            if (m_sky.AnimPath != null)
            {
                m_animation = LuaAnimation.Get(m_sky.AnimPath);
                m_animTime  = 0.0f;
            }
            if (m_sky.ModelPath != null)
            {
                var model = Model.Get(m_sky.ModelPath);
                m_model           = new ModelInstance(model, Matrix4.Identity);
                m_model.Animation = m_animation;
                m_model.AnimTime  = m_animTime;
                m_model.Animate();
            }
            if (m_sky.ForegroundModelPath != null)
            {
                var model = Model.Get(m_sky.ForegroundModelPath);
                m_foregroundModel           = new ModelInstance(model, Matrix4.Identity);
                m_foregroundModel.Animation = m_animation;
                m_foregroundModel.AnimTime  = m_animTime;
                m_foregroundModel.Animate();
            }
            AnimateLights();
        }
コード例 #2
0
ファイル: Level.cs プロジェクト: xiuzhifu/Redirection
        public Level(int minX, int minY, int minZ, int maxX, int maxY, int maxZ)
        {
            m_transform   = Matrix4.Identity;
            m_timeMachine = new TimeMachine();
            m_tileMap     = new TileMap(this, minX, minY, minZ, maxX, maxY, maxZ);

            m_entities         = new List <Entity>();
            m_entityCollection = new EntityCollection(this);
            m_info             = new LevelInfo();

            m_depthComparer       = new EntityDistanceComparer();
            m_depthSortedEntities = new List <Entity>();

            m_ambientLight        = new AmbientLight(new Vector3(0.5f, 0.5f, 0.5f));
            m_ambientLight.Active = true;

            m_skyLight        = new DirectionalLight(new Vector3(0.6f, -1.0f, -0.6f), new Vector3(0.5f, 0.5f, 0.5f));
            m_skyLight.Active = true;

            m_skyLight2        = new DirectionalLight(-Vector3.UnitY, Vector3.Zero);
            m_skyLight2.Active = false;

            m_pointLights     = new List <PointLight>();
            m_lightCollection = new LightCollection(this);

            m_telepadDirectory = new TelepadDirectory();
            m_hintDirectory    = new HintDirectory();

            Visible = true;
            Random  = new Random();

            m_flatOpaqueEffect     = new FlatEffectInstance();
            m_flatCutoutEffect     = new FlatCutoutEffectInstance();
            m_litOpaqueEffect      = new LitEffectInstance(RenderPass.Opaque);
            m_litCutoutEffect      = new LitEffectInstance(RenderPass.Cutout);
            m_litTranslucentEffect = new LitEffectInstance(RenderPass.Translucent);
            m_shadowEffect         = new ShadowEffectInstance();

            m_particles = new ParticleManager(this);
        }