Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2015-12-06 23:41:21 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2015-12-08 20:58:52 +0300
commitb25e4b310f87fc86942acd29fccf1474ea5120df (patch)
tree03b1b681faa42b99468f1ffa0d3da0f114ab8209 /source/blender/editors
parentaf5784312a1bb8079d2e1edffdb6d8f607029f9e (diff)
OpenGL: remove non-power-of-two texture check, where even ES 2.0 does not need it.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/interface/interface_icons.c2
-rw-r--r--source/blender/editors/space_view3d/drawobject.c4
-rw-r--r--source/blender/editors/space_view3d/drawvolume.c28
-rw-r--r--source/blender/editors/space_view3d/view3d_intern.h2
4 files changed, 13 insertions, 23 deletions
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index 43b48e31271..8e6558c74b8 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -627,7 +627,7 @@ static void init_internal_icons(void)
}
/* we only use a texture for cards with non-power of two */
- if (GPU_non_power_of_two_support()) {
+ if (GPU_full_non_power_of_two_support()) {
glGenTextures(1, &icongltex.id);
if (icongltex.id) {
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 8944c316f7e..f2240c662ab 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -8039,13 +8039,13 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short
if (!sds->wt || !(sds->viewsettings & MOD_SMOKE_VIEW_SHOWBIG)) {
sds->tex = NULL;
GPU_create_smoke(smd, 0);
- draw_smoke_volume(sds, ob, p0, p1, sds->res, viewnormal);
+ draw_smoke_volume(sds, ob, p0, p1, viewnormal);
GPU_free_smoke(smd);
}
else if (sds->wt && (sds->viewsettings & MOD_SMOKE_VIEW_SHOWBIG)) {
sds->tex = NULL;
GPU_create_smoke(smd, 1);
- draw_smoke_volume(sds, ob, p0, p1, sds->res_wt, viewnormal);
+ draw_smoke_volume(sds, ob, p0, p1, viewnormal);
GPU_free_smoke(smd);
}
diff --git a/source/blender/editors/space_view3d/drawvolume.c b/source/blender/editors/space_view3d/drawvolume.c
index 7f102bccff1..3029aaeeef1 100644
--- a/source/blender/editors/space_view3d/drawvolume.c
+++ b/source/blender/editors/space_view3d/drawvolume.c
@@ -135,9 +135,9 @@ static GPUTexture *create_flame_spectrum_texture(void)
void draw_smoke_volume(SmokeDomainSettings *sds, Object *ob,
const float min[3], const float max[3],
- const int res[3], const float viewnormal[3])
+ const float viewnormal[3])
{
- GPUTexture *tex_spec;
+ GPUTexture *tex_spec = NULL;
GPUProgram *smoke_program;
const int progtype = (sds->active_fields & SM_ACTIVE_COLORS) ? GPU_PROGRAM_SMOKE_COLORED
: GPU_PROGRAM_SMOKE;
@@ -152,7 +152,6 @@ void draw_smoke_volume(SmokeDomainSettings *sds, Object *ob,
float d /*, d0 */ /* UNUSED */, dd, ds;
float (*points)[3] = NULL;
int numpoints = 0;
- float cor[3] = {1.0f, 1.0f, 1.0f};
int gl_depth = 0, gl_blend = 0;
const bool use_fire = (sds->active_fields & SM_ACTIVE_FIRE) != 0;
@@ -171,6 +170,7 @@ void draw_smoke_volume(SmokeDomainSettings *sds, Object *ob,
};
const float size[3] = { max[0] - min[0], max[1] - min[1], max[2] - min[2] };
+ const float invsize[3] = { 1.0f / size[0], 1.0f / size[1], 1.0f / size[2] };
/* edges have the form edges[n][0][xyz] + t*edges[n][1][xyz] */
const float edges[12][2][3] = {
@@ -257,16 +257,6 @@ void draw_smoke_volume(SmokeDomainSettings *sds, Object *ob,
GPU_texture_bind(tex_spec, 3);
}
- if (!GPU_non_power_of_two_support()) {
- cor[0] = (float)res[0] / (float)power_of_2_max_u(res[0]);
- cor[1] = (float)res[1] / (float)power_of_2_max_u(res[1]);
- cor[2] = (float)res[2] / (float)power_of_2_max_u(res[2]);
- }
-
- cor[0] /= size[0];
- cor[1] /= size[1];
- cor[2] /= size[2];
-
/* our slices are defined by the plane equation a*x + b*y +c*z + d = 0
* (a,b,c), the plane normal, are given by viewdir
* d is the parameter along the view direction. the first d is given by
@@ -318,9 +308,9 @@ void draw_smoke_volume(SmokeDomainSettings *sds, Object *ob,
GPU_program_parameter_4f(smoke_program, 2, 1.0, 0.0, 0.0, 0.0);
glBegin(GL_POLYGON);
for (i = 0; i < numpoints; i++) {
- glTexCoord3d((points[i][0] - min[0]) * cor[0],
- (points[i][1] - min[1]) * cor[1],
- (points[i][2] - min[2]) * cor[2]);
+ glTexCoord3d((points[i][0] - min[0]) * invsize[0],
+ (points[i][1] - min[1]) * invsize[1],
+ (points[i][2] - min[2]) * invsize[2]);
glVertex3f(points[i][0] * ob_sizei[0],
points[i][1] * ob_sizei[1],
points[i][2] * ob_sizei[2]);
@@ -334,9 +324,9 @@ void draw_smoke_volume(SmokeDomainSettings *sds, Object *ob,
GPU_program_parameter_4f(smoke_program, 2, -1.0, 0.0, 0.0, 0.0);
glBegin(GL_POLYGON);
for (i = 0; i < numpoints; i++) {
- glTexCoord3d((points[i][0] - min[0]) * cor[0],
- (points[i][1] - min[1]) * cor[1],
- (points[i][2] - min[2]) * cor[2]);
+ glTexCoord3d((points[i][0] - min[0]) * invsize[0],
+ (points[i][1] - min[1]) * invsize[1],
+ (points[i][2] - min[2]) * invsize[2]);
glVertex3f(points[i][0] * ob_sizei[0],
points[i][1] * ob_sizei[1],
points[i][2] * ob_sizei[2]);
diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h
index 325fd9ecbe2..2c6d76240d9 100644
--- a/source/blender/editors/space_view3d/view3d_intern.h
+++ b/source/blender/editors/space_view3d/view3d_intern.h
@@ -274,7 +274,7 @@ extern const char *view3d_context_dir[]; /* doc access */
/* draw_volume.c */
void draw_smoke_volume(struct SmokeDomainSettings *sds, struct Object *ob,
const float min[3], const float max[3],
- const int res[3], const float viewnormal[3]);
+ const float viewnormal[3]);
//#define SMOKE_DEBUG_VELOCITY
//#define SMOKE_DEBUG_HEAT