OSDN Git Service

#32713 初コミット。SVNrev567時点での、ファイルはbranch/140707(ReBuild XGVersion)から移行したもの。
[dtxmaniaxg-verk/dtxmaniaxg-verk-git.git] / SlimDXc_Jun2010(VC++2008) / source / direct3d10 / Texture2D.h
1 /*
2 * Copyright (c) 2007-2010 SlimDX Group
3
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 * THE SOFTWARE.
21 */
22 #pragma once
23
24 #include "../ComObject.h"
25 #include "../DataRectangle.h"
26
27 #include "Enums.h"
28 #include "Resource10.h"
29 #include "ImageLoadInformation.h"
30
31 namespace SlimDX
32 {
33         ref class DataRectangle;
34         
35         namespace Direct3D10
36         {
37                 ref class Device;
38                 value class Texture2DDescription;
39                 
40                 public ref class Texture2D : public Resource
41                 {
42                         COMOBJECT(ID3D10Texture2D, Texture2D);
43                         
44                 private:
45                         static ID3D10Texture2D* Build( SlimDX::Direct3D10::Device^ device, Texture2DDescription description, D3D10_SUBRESOURCE_DATA* data ); 
46                 
47                 public:
48                         /// <summary>
49                         /// Gets the texture description.
50                         /// </summary>
51                         property Texture2DDescription Description
52                         {
53                                 Texture2DDescription get();
54                         }
55                         
56                         /// <summary>
57                         /// Initializes a new instance of the <see cref="Texture2D"/> class.
58                         /// </summary>
59                         /// <param name="device">The device to associate the texture with.</param>
60                         /// <param name="description">The description of the texture.</param>
61                         Texture2D( SlimDX::Direct3D10::Device^ device, Texture2DDescription description );
62                         
63                         /// <summary>
64                         /// Initializes a new instance of the <see cref="Texture2D"/> class.
65                         /// </summary>
66                         /// <param name="device">The device to associate the texture with.</param>
67                         /// <param name="description">The description of the texture.</param>
68                         /// <param name="data">The initial texture data.</param>
69                         Texture2D( SlimDX::Direct3D10::Device^ device, Texture2DDescription description, DataRectangle^ data );
70                         
71                         /// <summary>
72                         /// Initializes a new instance of the <see cref="Texture2D"/> class.
73                         /// </summary>
74                         /// <param name="device">The device to associate the texture with.</param>
75                         /// <param name="description">The description of the texture.</param>
76                         /// <param name="data">An array of initial texture data for each subresource.</param>
77                         Texture2D( SlimDX::Direct3D10::Device^ device, Texture2DDescription description, array<DataRectangle^>^ data );
78                 
79                         /// <summary>
80                         /// Maps the texture, providing CPU access to its contents.
81                         /// </summary>
82                         /// <param name="subresource">The subresource to map.</param>
83                         /// <param name="mode">The IO operations to enable on the CPU.</param>
84                         /// <param name="flags">Flags indicating how the CPU should respond when the GPU is busy.</param>
85                         /// <returns>A data rectangle containing the mapped data. This data stream is invalidated
86                         /// when the buffer is unmapped.</returns>
87                         DataRectangle^ Map( int subresource, MapMode mode, MapFlags flags );
88                         
89                         /// <summary>
90                         /// Unmaps the texture.
91                         /// </summary>
92                         /// <param name="subresource">The subresource to unmap.</param>
93                         void Unmap( int subresource );
94                         
95                         static Texture2D^ FromFile( SlimDX::Direct3D10::Device^ device, System::String^ fileName );
96                         static Texture2D^ FromFile( SlimDX::Direct3D10::Device^ device, System::String^ fileName, ImageLoadInformation loadInfo );
97                         static Texture2D^ FromMemory( SlimDX::Direct3D10::Device^ device, array<System::Byte>^ memory );
98                         static Texture2D^ FromMemory( SlimDX::Direct3D10::Device^ device, array<System::Byte>^ memory, ImageLoadInformation loadInfo );
99                         static Texture2D^ FromStream( SlimDX::Direct3D10::Device^ device, System::IO::Stream^ stream, int sizeInBytes );
100                         static Texture2D^ FromStream( SlimDX::Direct3D10::Device^ device, System::IO::Stream^ stream, int sizeInBytes, ImageLoadInformation loadInfo );
101
102                         static Result ToFile( Texture2D^ texture, ImageFileFormat format, System::String^ fileName );
103                         static Result ToStream( Texture2D^ texture, ImageFileFormat format, System::IO::Stream^ stream );
104
105                         static Result ComputeNormalMap(Texture2D^ source, Texture2D^ destination, NormalMapFlags flags, Channel channel, float amplitude);
106                 };
107         }
108 };