Panda3D
Loading...
Searching...
No Matches
dxTextureContext9.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file dxTextureContext9.h
10 * @author drose
11 * @date 1999-10-07
12 */
13
14#ifndef DXTEXTURECONTEXT9_H
15#define DXTEXTURECONTEXT9_H
16
17#include "dxgsg9base.h"
18#include "texture.h"
19#include "textureContext.h"
20
21/**
22 *
23 */
24class EXPCL_PANDADX DXTextureContext9 : public TextureContext {
25public:
27 virtual ~DXTextureContext9();
28
29 virtual void evict_lru();
30
31 bool create_texture(DXScreenData &scrn);
32 bool create_simple_texture(DXScreenData &scrn);
33 void delete_texture();
34 bool extract_texture_data(DXScreenData &scrn);
35
36 INLINE bool has_mipmaps() const;
37 INLINE IDirect3DBaseTexture9 *get_d3d_texture() const;
38 INLINE IDirect3DTexture9 *get_d3d_2d_texture() const;
39 INLINE IDirect3DVolumeTexture9 *get_d3d_volume_texture() const;
40 INLINE IDirect3DCubeTexture9 *get_d3d_cube_texture() const;
41
42 static HRESULT d3d_surface_to_texture(RECT &source_rect,
43 IDirect3DSurface9 *d3d_surface,
44 bool inverted, Texture *result,
45 int view, int z);
46
47private:
48 HRESULT fill_d3d_texture_mipmap_pixels(int mip_level, int depth_index, D3DFORMAT source_format);
49 HRESULT fill_d3d_texture_pixels(DXScreenData &scrn, bool compress_texture);
50 HRESULT fill_d3d_volume_texture_pixels(DXScreenData &scrn);
51 static int down_to_power_2(int value);
52 unsigned int get_bits_per_pixel(Texture::Format format, int *alphbits);
53 PN_stdfloat d3d_format_to_bytes_per_pixel (D3DFORMAT format);
54
55private:
56 D3DFORMAT _d3d_format; // the 'D3DFORMAT' the Panda TextureBuffer fmt corresponds to
57 IDirect3DBaseTexture9 *_d3d_texture;
58 IDirect3DTexture9 *_d3d_2d_texture;
59 IDirect3DVolumeTexture9 *_d3d_volume_texture;
60 IDirect3DCubeTexture9 *_d3d_cube_texture;
61
62 int _managed;
63
64private:
65 bool _has_mipmaps;
66 bool _is_render_target;
67
68public:
69 static TypeHandle get_class_type() {
70 return _type_handle;
71 }
72 static void init_type() {
73 TextureContext::init_type();
74 register_type(_type_handle, "DXTextureContext9",
75 TextureContext::get_class_type());
76 }
77 virtual TypeHandle get_type() const {
78 return get_class_type();
79 }
80 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
81
82private:
83 static TypeHandle _type_handle;
84
85 friend class wdxGraphicsBuffer9;
86};
87
88#include "dxTextureContext9.I"
89
90#endif
virtual void evict_lru()
Evicts the page from the LRU.
A table of objects that are saved within the graphics context for reference by handle later.
This is a special class object that holds all the information returned by a particular GSG to indicat...
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
Definition texture.h:72
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
An offscreen render buffer.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.