예제 #1
0
        /// <summary>Cette méthode se charge de créer un buffer qui correspond aux dimensions des différentes
        /// constantes existante.
        /// </summary>
        private void InitializeBuffer()
        {
            if (m_ConstantBuffer != null)
            {
                m_ConstantBuffer.Dispose();
            }

            m_ConstantBuffer = new CBuffer <LightsDesc>(1, m_Data);
        }
예제 #2
0
        public ProjectorManager()
        {
            Instance     = this;
            description_ = new ProjectorsDesc
            {
                ProjectorCount = 0,
                Projectors     = new ProjectorDesc[10]
            };

            constantBuffer_ = new CBuffer <ProjectorsDesc>(3, description_);
        }
예제 #3
0
 public LightManager()
 {
     m_MaxLights   = 10;
     Instance      = this;
     m_Data        = new LightsDesc();
     m_Data.Lights = new LightDesc[m_MaxLights];
     SetAcneBias(0.005f);
     m_Data.ActivatePCF = false;
     // Pour les lumières, je réserve le buffer d'index 1
     m_ConstantBuffer = new CBuffer <LightsDesc>(1, m_Data);
     InitializeBuffer();
 }
예제 #4
0
        private void InitializeConstantBuffer()
        {
            worldviewproj_ = new WorldViewProj()
            {
                World          = worldmatrix_,
                WorldInverse   = new Matrix(),
                View           = new Matrix(),
                Projection     = new Matrix(),
                CameraPosition = new Vector3()
            };

            // Le constant buffer des transformations devra toujours se trouver à l'index 0 pour éviter les blagues
            constantbuffer_ = new CBuffer <WorldViewProj>(0, worldviewproj_);
        }
예제 #5
0
        public MaterialDX11(string vs = "vDefault.cso", string ps = "pUnlit.cso", string gs = "gDefault.cso", VertexTypeD11 type = VertexTypeD11.STANDARD_VERTEX)
        {
            LoadShaders(vs, ps, gs);
            SetInputLayout(type);

            m_TextureConstantBufferDesc = new TextureConstantBufferDesc()
            {
                TilingHeight = 1.0f,
                TilingWidth  = 1.0f,
                XOffset      = 0.0f,
                YOffset      = 0.0f,
                HasTexture   = false,
                MainColor    = new Vector4(0.7f, 0.7f, 0.7f, 1.0f)
            };

            m_MaterialDesc = new MaterialDesc(0.1f, 0.5f, 0.5f);

            m_TextureConstantBuffer = new CBuffer <TextureConstantBufferDesc>(5, m_TextureConstantBufferDesc);
            m_MaterialCBufferDesc   = new CBuffer <MaterialDesc>(4, m_MaterialDesc);
        }
예제 #6
0
        public Billboard()
        {
            MaterialDX11 mat = new MaterialDX11("vBillboarding.cso", "pUnlit.cso", "gBillboarding.cso");

            mat.SetMainColor(0.0f, 0.0f, 1.0f, 1.0F);

            PointMesh pm = new PointMesh();

            pm.AddVertex(new StandardVertex(new Vector3(0.0f, 0.0f, 0.0f)));
            pm.UpdateBuffers();

            //modelrenderer_ = new MeshRenderer( mat, pm );

            desc = new BillboardDesc()
            {
                CameraUpVector = new Vector3(1.0f, 0.0f, 0.0f),
                ScaleValue     = new Vector3(1.0f, 1.0f, 1.0f)
            };

            buffer_ = new CBuffer <BillboardDesc>(6, desc);
        }
예제 #7
0
 /// <summary>
 /// Ajoute un constant buffer de type T ( ou T est une structure dont l'organisation des données est controlé
 /// pour être conformes aux spécifications hlsl (comprendre, par bloc de 16 octets)
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="data"></param>
 public void AddConstantBuffer <T>(T data) where T : struct
 {
     constantBuffer = new CBuffer <T>(2, data);
 }