Creates the surfaces we use for uploading
| 936 | |
| 937 | // Creates the surfaces we use for uploading |
| 938 | int d3d_CreateUploadSurfaces() { |
| 939 | int i; |
| 940 | HRESULT ddrval; |
| 941 | |
| 942 | for (i = 0; i < NUM_TEXTURE_CLASSES; i++) { |
| 943 | // Create a texture interface and make it auto-managed |
| 944 | DDSURFACEDESC2 ddsd; |
| 945 | |
| 946 | memset(&ddsd, 0, sizeof(ddsd)); |
| 947 | ddsd.dwSize = sizeof(ddsd); |
| 948 | ddsd.dwFlags = DDSD_CAPS; |
| 949 | ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; |
| 950 | ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT; |
| 951 | |
| 952 | ddsd.dwWidth = 256 >> i; |
| 953 | ddsd.dwHeight = 256 >> i; |
| 954 | |
| 955 | ddsd.ddpfPixelFormat = RGB_texture_format; |
| 956 | |
| 957 | ddrval = lpDD->CreateSurface(&ddsd, &UploadSurfaces[i], NULL); |
| 958 | |
| 959 | if (ddrval != DD_OK) { |
| 960 | mprintf(0, "Creating 1555 texture surface failed!\n"); |
| 961 | return 0; |
| 962 | } |
| 963 | } |
| 964 | |
| 965 | // Now create 4444 surfaces |
| 966 | for (i = 0; i < NUM_TEXTURE_CLASSES; i++) { |
| 967 | // Create a texture interface and make it auto-managed |
| 968 | DDSURFACEDESC2 ddsd; |
| 969 | |
| 970 | memset(&ddsd, 0, sizeof(ddsd)); |
| 971 | ddsd.dwSize = sizeof(ddsd); |
| 972 | ddsd.dwFlags = DDSD_CAPS; |
| 973 | ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE; |
| 974 | ddsd.ddsCaps.dwCaps2 = DDSCAPS2_TEXTUREMANAGE; |
| 975 | ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT; |
| 976 | |
| 977 | ddsd.dwWidth = 256 >> i; |
| 978 | ddsd.dwHeight = 256 >> i; |
| 979 | |
| 980 | ddsd.ddpfPixelFormat = Texture_4444_format; |
| 981 | |
| 982 | ddrval = lpDD->CreateSurface(&ddsd, &Upload4444Surfaces[i], NULL); |
| 983 | |
| 984 | if (ddrval != DD_OK) { |
| 985 | mprintf(0, "Creating 4444 texture surface failed!\n"); |
| 986 | return 0; |
| 987 | } |
| 988 | } |
| 989 | |
| 990 | return 1; |
| 991 | } |
| 992 | |
| 993 | // Loads an environment map for bumpmapping. Returns 1 on success, 0 on fail |
| 994 | int d3d_LoadEnvironmentMap() { |
no outgoing calls
no test coverage detected