Cleanup: Various clang-tidy warnings in render

Pull Request: https://projects.blender.org/blender/blender/pulls/133734
This commit is contained in:
Brecht Van Lommel
2025-01-26 20:07:59 +01:00
parent 011060aa03
commit b78fa81ed4
26 changed files with 102 additions and 183 deletions

View File

@@ -21,7 +21,7 @@ struct Render;
extern "C" {
#endif
typedef struct BakeImage {
struct BakeImage {
struct Image *image;
int tile_number;
float uv_offset[2];
@@ -31,9 +31,9 @@ typedef struct BakeImage {
/* For associating render result layer with image. */
char render_layer_name[RE_MAXNAME];
} BakeImage;
};
typedef struct BakeTargets {
struct BakeTargets {
/* All images of the object. */
BakeImage *images;
int images_num;
@@ -49,17 +49,17 @@ typedef struct BakeTargets {
/* Baking to non-color data image. */
bool is_noncolor;
} BakeTargets;
};
typedef struct BakePixel {
struct BakePixel {
int primitive_id, object_id;
int seed;
float uv[2];
float du_dx, du_dy;
float dv_dx, dv_dy;
} BakePixel;
};
typedef struct BakeHighPolyData {
struct BakeHighPolyData {
struct Object *ob;
struct Object *ob_eval;
struct Mesh *mesh;
@@ -67,7 +67,7 @@ typedef struct BakeHighPolyData {
float obmat[4][4];
float imat[4][4];
} BakeHighPolyData;
};
/* `external_engine.cc` */

View File

@@ -71,7 +71,7 @@ enum RenderEngineFlag {
extern ListBase R_engines;
typedef struct RenderEngineType {
struct RenderEngineType {
struct RenderEngineType *next, *prev;
/* type info */
@@ -120,17 +120,17 @@ typedef struct RenderEngineType {
/* RNA integration */
ExtensionRNA rna_ext;
} RenderEngineType;
};
typedef void (*update_render_passes_cb_t)(void *userdata,
struct Scene *scene,
struct ViewLayer *view_layer,
const char *name,
int channels,
const char *chanid,
eNodeSocketDatatype type);
using update_render_passes_cb_t = void (*)(void *userdata,
struct Scene *scene,
struct ViewLayer *view_layer,
const char *name,
int channels,
const char *chanid,
eNodeSocketDatatype type);
typedef struct RenderEngine {
struct RenderEngine {
RenderEngineType *type;
void *py_instance;
@@ -170,7 +170,7 @@ typedef struct RenderEngine {
struct GPUContext *blender_gpu_context;
/* Whether to restore DRWState after RenderEngine display pass. */
bool gpu_restore_context;
} RenderEngine;
};
RenderEngine *RE_engine_create(RenderEngineType *type);
void RE_engine_free(RenderEngine *engine);

View File

@@ -19,7 +19,7 @@ struct Scene;
extern "C" {
#endif
typedef struct MultiresBakeRender {
struct MultiresBakeRender {
Scene *scene;
DerivedMesh *lores_dm, *hires_dm;
int bake_margin;
@@ -51,7 +51,7 @@ typedef struct MultiresBakeRender {
bool *stop;
bool *do_update;
float *progress;
} MultiresBakeRender;
};
void RE_multires_bake_images(struct MultiresBakeRender *bkr);

View File

@@ -38,9 +38,7 @@ extern "C" {
#define RE_MAXNAME ((MAX_ID_NAME - 2) + 10)
/* only used as handle */
typedef struct Render Render;
typedef struct RenderView {
struct RenderView {
struct RenderView *next, *prev;
char name[64]; /* EXR_VIEW_MAXNAME */
@@ -48,9 +46,9 @@ typedef struct RenderView {
* The ibuf is only allocated if it has an actual data in one of its buffers (float, byte, or
* GPU). */
struct ImBuf *ibuf;
} RenderView;
};
typedef struct RenderPass {
struct RenderPass {
struct RenderPass *next, *prev;
int channels;
char name[64]; /* amount defined in IMB_openexr.hh */
@@ -72,7 +70,7 @@ typedef struct RenderPass {
int view_id; /* quick lookup */
char _pad0[4];
} RenderPass;
};
/**
* - A render-layer is a full image, but with all passes and samples.
@@ -80,7 +78,7 @@ typedef struct RenderPass {
* - After render, the Combined pass is in combined,
* for render-layers read from files it is a real pass.
*/
typedef struct RenderLayer {
struct RenderLayer {
struct RenderLayer *next, *prev;
/** copy of RenderData */
@@ -93,10 +91,9 @@ typedef struct RenderLayer {
void *exrhandle;
ListBase passes;
};
} RenderLayer;
typedef struct RenderResult {
struct RenderResult {
struct RenderResult *next, *prev;
/* The number of users of this render result. Default value is 0. The result is freed when
@@ -145,16 +142,16 @@ typedef struct RenderResult {
struct StampData *stamp_data;
bool passes_allocated;
} RenderResult;
};
typedef struct RenderStats {
struct RenderStats {
int cfra;
bool localview;
double starttime, lastframetime;
const char *infostr, *statstr;
char scene_name[MAX_ID_NAME - 2];
float mem_used, mem_peak;
} RenderStats;
};
/* *********************** API ******************** */

View File

@@ -83,12 +83,12 @@ void RE_point_density_fix_linking(void);
/**
* Texture evaluation result.
*/
typedef struct TexResult {
struct TexResult {
float tin;
float trgba[4];
/* Is actually a boolean: When true -> use alpha, false -> set alpha to 1.0. */
int talpha;
} TexResult;
};
/* This one uses nodes. */

View File

@@ -28,7 +28,7 @@ pxr::VtValue LightTasksDelegate::Get(pxr::SdfPath const &id, pxr::TfToken const
if (id == simple_task_id_) {
return pxr::VtValue(simple_task_params_);
}
else if (id == skydome_task_id_) {
if (id == skydome_task_id_) {
return pxr::VtValue(skydome_task_params_);
}
}

View File

@@ -12,7 +12,7 @@ namespace blender::render::hydra {
class LightTasksDelegate : public pxr::HdSceneDelegate {
public:
LightTasksDelegate(pxr::HdRenderIndex *parentIndex, pxr::SdfPath const &delegate_id);
LightTasksDelegate(pxr::HdRenderIndex *parent_index, pxr::SdfPath const &delegate_id);
~LightTasksDelegate() override = default;
/* Delegate methods */

View File

@@ -15,8 +15,6 @@
#include "BKE_context.hh"
#include "RE_engine.h"
#include "RNA_prototypes.hh"
#include "hydra/image.hh"

View File

@@ -14,7 +14,7 @@
#include "MEM_guardedalloc.h"
#include "Eigen/Core"
#include <Eigen/Core>
#include "engine.hh"

View File

@@ -42,7 +42,7 @@ class ViewportEngine : public Engine {
void render(bContext *context);
protected:
void notify_status(float progress, const std::string &title, const std::string &info) override;
void notify_status(float progress, const std::string &info, const std::string &status) override;
};
} // namespace blender::render::hydra

View File

@@ -24,8 +24,6 @@
#include "IMB_imbuf.hh"
#include "DEG_depsgraph_query.hh"
#include "COM_context.hh"
#include "COM_domain.hh"
#include "COM_evaluator.hh"
@@ -37,6 +35,7 @@
#include "WM_api.hh"
#include "GPU_context.hh"
#include "GPU_state.hh"
#include "render_types.h"
@@ -256,12 +255,10 @@ class Context : public compositor::Context {
if (render_size == output_result_.domain().size) {
return output_result_;
}
else {
/* Otherwise, the size changed, so release its data and reset it, then we reallocate it on
* the new render size below. */
output_result_.release();
output_result_.reset();
}
/* Otherwise, the size changed, so release its data and reset it, then we reallocate it on
* the new render size below. */
output_result_.release();
output_result_.reset();
}
output_result_.allocate_texture(render_size, false);
@@ -282,12 +279,10 @@ class Context : public compositor::Context {
{
return viewer_output_result_;
}
else {
/* Otherwise, the size or precision changed, so release its data and reset it, then we
* reallocate it on the new domain below. */
viewer_output_result_.release();
viewer_output_result_.reset();
}
/* Otherwise, the size or precision changed, so release its data and reset it, then we
* reallocate it on the new domain below. */
viewer_output_result_.release();
viewer_output_result_.reset();
}
viewer_output_result_.set_precision(precision);

View File

@@ -12,7 +12,6 @@
#include "MEM_guardedalloc.h"
#include "BLI_ghash.h"
#include "BLI_listbase.h"
#include "BLI_math_bits.h"
#include "BLI_string.h"

View File

@@ -9,20 +9,19 @@
/* Global includes */
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include "MEM_guardedalloc.h"
#include "BLI_math_base.h"
#include "BLI_math_matrix.h"
#include "BLI_rect.h"
#include "BLI_utildefines.h"
#include "DNA_scene_types.h"
#include "BKE_camera.h"
/* this module */
#include "RE_pipeline.h"
#include "render_types.h"
/* ****************** MASKS and LUTS **************** */

View File

@@ -10,6 +10,7 @@
#include "MEM_guardedalloc.h"
#include "DNA_modifier_types.h"
#include "DNA_scene_types.h"
#include "BLI_listbase.h"
@@ -27,7 +28,6 @@
#include "BKE_mesh.hh"
#include "BKE_mesh_legacy_derived_mesh.hh"
#include "BKE_mesh_tangent.hh"
#include "BKE_modifier.hh"
#include "BKE_multires.hh"
#include "BKE_subsurf.hh"
@@ -526,14 +526,14 @@ static void do_multires_bake(MultiresBakeRender *bkr,
/* Copy sharp faces and edges, for corner normals domain and tangents
* to be computed correctly. */
if (sharp_edges) {
if (sharp_edges != nullptr) {
bke::MutableAttributeAccessor attributes = temp_mesh->attributes_for_write();
attributes.add<bool>("sharp_edge",
bke::AttrDomain::Edge,
bke::AttributeInitVArray(VArray<bool>::ForSpan(
Span<bool>(sharp_edges, temp_mesh->edges_num))));
}
if (sharp_faces) {
if (sharp_faces != nullptr) {
bke::MutableAttributeAccessor attributes = temp_mesh->attributes_for_write();
attributes.add<bool>("sharp_face",
bke::AttrDomain::Face,
@@ -633,7 +633,7 @@ static void do_multires_bake(MultiresBakeRender *bkr,
BLI_threadpool_end(&threads);
}
else {
do_multires_bake_thread(&handles[0]);
do_multires_bake_thread(handles.data());
}
for (i = 0; i < tot_thread; i++) {

View File

@@ -9,23 +9,18 @@
#include <fmt/format.h>
#include <cerrno>
#include <climits>
#include <cmath>
#include <cstddef>
#include <cstdlib>
#include <cstring>
#include <forward_list>
#include "DNA_anim_types.h"
#include "DNA_collection_types.h"
#include "DNA_image_types.h"
#include "DNA_node_types.h"
#include "DNA_object_types.h"
#include "DNA_particle_types.h"
#include "DNA_scene_types.h"
#include "DNA_sequence_types.h"
#include "DNA_space_types.h"
#include "DNA_userdef_types.h"
#include "DNA_windowmanager_types.h"
#include "MEM_guardedalloc.h"
@@ -1192,8 +1187,8 @@ static Scene *get_scene_referenced_by_node(const bNode *node)
if (node->type_legacy == CMP_NODE_R_LAYERS) {
return reinterpret_cast<Scene *>(node->id);
}
else if (node->type_legacy == CMP_NODE_CRYPTOMATTE &&
node->custom1 == CMP_NODE_CRYPTOMATTE_SOURCE_RENDER)
if (node->type_legacy == CMP_NODE_CRYPTOMATTE &&
node->custom1 == CMP_NODE_CRYPTOMATTE_SOURCE_RENDER)
{
return reinterpret_cast<Scene *>(node->id);
}

View File

@@ -19,11 +19,9 @@
#include "BLI_rect.h"
#include "BLI_string.h"
#include "BLI_string_utils.hh"
#include "BLI_threads.h"
#include "BLI_utildefines.h"
#include "BKE_appdir.hh"
#include "BKE_global.hh"
#include "BKE_image.hh"
#include "BKE_image_format.hh"
#include "BKE_image_save.hh"

View File

@@ -8,6 +8,8 @@
#pragma once
#include "BKE_global.hh" /* IWYU pragma: keep. Used in macro. */
#define PASS_VECTOR_MAX 10000.0f
#define RR_ALL_LAYERS NULL

View File

@@ -135,7 +135,7 @@ struct Render : public BaseRender {
/* NOTE: Currently unused, provision for the future.
* Add these now to allow the guarded memory allocator to catch C-specific function calls. */
Render() = default;
virtual ~Render();
~Render() override;
blender::render::TilesHighlight *get_tile_highlight() override
{

View File

@@ -8,6 +8,8 @@
#pragma once
#include "BLI_math_color.h" /* IWYU pragma: keep. Used in macros. */
#ifdef __cplusplus
extern "C" {
#endif

View File

@@ -23,7 +23,6 @@
#include "DNA_image_types.h"
#include "DNA_texture_types.h"
#include "BLI_math_color.h"
#include "BLI_math_interp.hh"
#include "BLI_math_vector.h"
#include "BLI_rect.h"
@@ -303,9 +302,7 @@ static void clipx_rctf_swap(rctf *stack, short *count, float x1, float x2)
rf->xmax += (x2 - x1);
}
else {
if (rf->xmax > x2) {
rf->xmax = x2;
}
rf->xmax = std::min(rf->xmax, x2);
newrct = stack + *count;
(*count)++;
@@ -327,9 +324,7 @@ static void clipx_rctf_swap(rctf *stack, short *count, float x1, float x2)
rf->xmax -= (x2 - x1);
}
else {
if (rf->xmin < x1) {
rf->xmin = x1;
}
rf->xmin = std::max(rf->xmin, x1);
newrct = stack + *count;
(*count)++;
@@ -363,9 +358,7 @@ static void clipy_rctf_swap(rctf *stack, short *count, float y1, float y2)
rf->ymax += (y2 - y1);
}
else {
if (rf->ymax > y2) {
rf->ymax = y2;
}
rf->ymax = std::min(rf->ymax, y2);
newrct = stack + *count;
(*count)++;
@@ -387,9 +380,7 @@ static void clipy_rctf_swap(rctf *stack, short *count, float y1, float y2)
rf->ymax -= (y2 - y1);
}
else {
if (rf->ymin < y1) {
rf->ymin = y1;
}
rf->ymin = std::max(rf->ymin, y1);
newrct = stack + *count;
(*count)++;
@@ -424,12 +415,8 @@ static float clipx_rctf(rctf *rf, float x1, float x2)
size = BLI_rctf_size_x(rf);
if (rf->xmin < x1) {
rf->xmin = x1;
}
if (rf->xmax > x2) {
rf->xmax = x2;
}
rf->xmin = std::max(rf->xmin, x1);
rf->xmax = std::min(rf->xmax, x2);
if (rf->xmin > rf->xmax) {
rf->xmin = rf->xmax;
return 0.0;
@@ -446,12 +433,8 @@ static float clipy_rctf(rctf *rf, float y1, float y2)
size = BLI_rctf_size_y(rf);
if (rf->ymin < y1) {
rf->ymin = y1;
}
if (rf->ymax > y2) {
rf->ymax = y2;
}
rf->ymin = std::max(rf->ymin, y1);
rf->ymax = std::min(rf->ymax, y2);
if (rf->ymin > rf->ymax) {
rf->ymin = rf->ymax;
@@ -476,12 +459,8 @@ static void boxsampleclip(ImBuf *ibuf, const rctf *rf, TexResult *texres)
starty = int(floor(rf->ymin));
endy = int(floor(rf->ymax));
if (startx < 0) {
startx = 0;
}
if (starty < 0) {
starty = 0;
}
startx = std::max(startx, 0);
starty = std::max(starty, 0);
if (endx >= ibuf->x) {
endx = ibuf->x - 1;
}
@@ -706,16 +685,12 @@ static int ibuf_get_color_clip(float col[4], ImBuf *ibuf, int x, int y, int extf
y %= ibuf->y;
y += (y < 0) ? ibuf->y : 0;
break;
default: { /* as extend, if clipped, set alpha to 0.0 */
if (x < 0) {
x = 0;
} /* TXF alpha: clip = 1; } */
default: { /* as extend, if clipped, set alpha to 0.0 */
x = std::max(x, 0); /* TXF alpha: clip = 1; } */
if (x >= ibuf->x) {
x = ibuf->x - 1;
} /* TXF alpha: clip = 1; } */
if (y < 0) {
y = 0;
} /* TXF alpha: clip = 1; } */
} /* TXF alpha: clip = 1; } */
y = std::max(y, 0); /* TXF alpha: clip = 1; } */
if (y >= ibuf->y) {
y = ibuf->y - 1;
} /* TXF alpha: clip = 1; } */
@@ -1035,12 +1010,8 @@ static int imagewraposa_aniso(Tex *tex,
/* Make sure the filtersize is minimal in pixels
* (normal, ref map can have miniature pixel dx/dy). */
const float addval = (0.5f * tex->filtersize) / float(std::min(ibuf->x, ibuf->y));
if (addval > minx) {
minx = addval;
}
if (addval > miny) {
miny = addval;
}
minx = std::max(addval, minx);
miny = std::max(addval, miny);
}
else if (tex->filtersize != 1.0f) {
minx *= tex->filtersize;
@@ -1439,12 +1410,8 @@ int imagewraposa(Tex *tex,
* (normal, ref map can have miniature pixel dx/dy). */
float addval = (0.5f * tex->filtersize) / float(std::min(ibuf->x, ibuf->y));
if (addval > minx) {
minx = addval;
}
if (addval > miny) {
miny = addval;
}
minx = std::max(addval, minx);
miny = std::max(addval, miny);
}
else if (tex->filtersize != 1.0f) {
minx *= tex->filtersize;
@@ -1636,9 +1603,7 @@ int imagewraposa(Tex *tex,
dx = minx;
dy = miny;
maxd = max_ff(dx, dy);
if (maxd > 0.5f) {
maxd = 0.5f;
}
maxd = std::min(maxd, 0.5f);
pixsize = 1.0f / float(std::min(ibuf->x, ibuf->y));
@@ -1656,12 +1621,8 @@ int imagewraposa(Tex *tex,
if (previbuf != curibuf || (tex->imaflag & TEX_INTERPOL)) {
/* sample at least 1 pixel */
if (minx < 0.5f / ibuf->x) {
minx = 0.5f / ibuf->x;
}
if (miny < 0.5f / ibuf->y) {
miny = 0.5f / ibuf->y;
}
minx = std::max(minx, 0.5f / ibuf->x);
miny = std::max(miny, 0.5f / ibuf->y);
}
maxx = fx + minx;
@@ -1695,12 +1656,8 @@ int imagewraposa(Tex *tex,
const int intpol = tex->imaflag & TEX_INTERPOL;
if (intpol) {
/* sample 1 pixel minimum */
if (minx < 0.5f / ibuf->x) {
minx = 0.5f / ibuf->x;
}
if (miny < 0.5f / ibuf->y) {
miny = 0.5f / ibuf->y;
}
minx = std::max(minx, 0.5f / ibuf->x);
miny = std::max(miny, 0.5f / ibuf->y);
}
boxsample(ibuf, fx - minx, fy - miny, fx + minx, fy + miny, texres, imaprepeat, imapextend);

View File

@@ -29,7 +29,6 @@
#include <algorithm>
#include <cmath>
#include <valarray>
namespace blender::render::texturemargin {
@@ -88,14 +87,14 @@ class TextureMarginMap {
zbuf_free_span(&zspan_);
}
inline void set_pixel(int x, int y, uint32_t value)
void set_pixel(int x, int y, uint32_t value)
{
BLI_assert(x < w_);
BLI_assert(x >= 0);
pixel_data_[y * w_ + x] = value;
}
inline uint32_t get_pixel(int x, int y) const
uint32_t get_pixel(int x, int y) const
{
if (x < 0 || y < 0 || x >= w_ || y >= h_) {
return 0xFFFFFFFF;

View File

@@ -12,9 +12,9 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_color.hh"
#include "BLI_kdopbvh.hh"
#include "BLI_listbase.h"
#include "BLI_math_color.h"
#include "BLI_math_matrix.h"
#include "BLI_math_vector.h"

View File

@@ -6,8 +6,8 @@
* \ingroup render
*/
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
@@ -16,7 +16,6 @@
#include "BLI_rand.h"
#include "BLI_utildefines.h"
#include "DNA_image_types.h"
#include "DNA_material_types.h"
#include "DNA_node_types.h"
#include "DNA_texture_types.h"
@@ -29,8 +28,6 @@
#include "NOD_texture.h"
#include "MEM_guardedalloc.h"
#include "texture_common.h"
#include "RE_texture.h"
@@ -99,9 +96,7 @@ static int blend(const Tex *tex, const float texvec[3], TexResult *texres)
}
else { /* sphere TEX_SPHERE */
texres->tin = 1.0f - sqrtf(x * x + y * y + texvec[2] * texvec[2]);
if (texres->tin < 0.0f) {
texres->tin = 0.0f;
}
texres->tin = std::max(texres->tin, 0.0f);
if (tex->stype == TEX_HALO) {
texres->tin *= texres->tin; /* Halo. */
}
@@ -395,9 +390,7 @@ static int stucci(const Tex *tex, const float texvec[3], TexResult *texres)
texres->tin = 1.0f - texres->tin;
}
if (texres->tin < 0.0f) {
texres->tin = 0.0f;
}
texres->tin = std::max(texres->tin, 0.0f);
return retval;
}
@@ -530,9 +523,7 @@ static int voronoiTex(const Tex *tex, const float texvec[3], TexResult *texres)
texres->trgba[2] += aw4 * ca[2];
if (ELEM(tex->vn_coltype, TEX_COL2, TEX_COL3)) {
float t1 = (da[1] - da[0]) * 10;
if (t1 > 1) {
t1 = 1;
}
t1 = std::min<float>(t1, 1);
if (tex->vn_coltype == TEX_COL3) {
t1 *= texres->tin;
}
@@ -848,9 +839,7 @@ static void do_2d_mapping(
}
}
if (max < tex->yrepeat) {
max = tex->yrepeat;
}
max = std::max<float>(max, tex->yrepeat);
dxt[1] *= tex->yrepeat;
dyt[1] *= tex->yrepeat;

View File

@@ -42,11 +42,11 @@ class TilesHighlight {
uint64_t hash() const;
inline bool operator==(const Tile &other) const
bool operator==(const Tile &other) const
{
return rect == other.rect;
}
inline bool operator!=(const Tile &other) const
bool operator!=(const Tile &other) const
{
return !(*this == other);
}

View File

@@ -13,6 +13,7 @@
/* Common includes */
/*---------------------------------------------------------------------------*/
#include <algorithm>
#include <cstring>
#include "MEM_guardedalloc.h"
@@ -84,9 +85,7 @@ static void zbuf_add_to_span(ZSpan *zspan, const float v1[2], const float v2[2])
my2 = zspan->recty - 1;
}
/* clip bottom */
if (my0 < 0) {
my0 = 0;
}
my0 = std::max(my0, 0);
if (my0 > my2) {
return;
@@ -124,12 +123,8 @@ static void zbuf_add_to_span(ZSpan *zspan, const float v1[2], const float v2[2])
if (zspan->maxp1 == nullptr || zspan->maxp1[1] < maxv[1]) {
zspan->maxp1 = maxv;
}
if (my0 < zspan->miny1) {
zspan->miny1 = my0;
}
if (my2 > zspan->maxy1) {
zspan->maxy1 = my2;
}
zspan->miny1 = std::min(my0, zspan->miny1);
zspan->maxy1 = std::max(my2, zspan->maxy1);
}
else {
// printf("right span my0 %d my2 %d\n", my0, my2);
@@ -139,12 +134,8 @@ static void zbuf_add_to_span(ZSpan *zspan, const float v1[2], const float v2[2])
if (zspan->maxp2 == nullptr || zspan->maxp2[1] < maxv[1]) {
zspan->maxp2 = maxv;
}
if (my0 < zspan->miny2) {
zspan->miny2 = my0;
}
if (my2 > zspan->maxy2) {
zspan->maxy2 = my2;
}
zspan->miny2 = std::min(my0, zspan->miny2);
zspan->maxy2 = std::max(my2, zspan->maxy2);
}
for (y = my2; y >= my0; y--, xs0 += dx0) {
@@ -236,9 +227,7 @@ void zspan_scanconvert(ZSpan *zspan,
if (sn2 >= rectx) {
sn2 = rectx - 1;
}
if (sn1 < 0) {
sn1 = 0;
}
sn1 = std::max(sn1, 0);
u = ((double(sn1) * uxd) + uy0) - (i * uyd);
v = ((double(sn1) * vxd) + vy0) - (i * vyd);

View File

@@ -13,13 +13,13 @@ extern "C" {
#endif
/** Span fill in method, is also used to localize data for Z-buffering. */
typedef struct ZSpan {
struct ZSpan {
int rectx, recty; /* range for clipping */
int miny1, maxy1, miny2, maxy2; /* actual filled in range */
const float *minp1, *maxp1, *minp2, *maxp2; /* vertex pointers detect min/max range in */
float *span1, *span2;
} ZSpan;
};
/**
* Each Z-buffer has coordinates transformed to local rect coordinates, so we can simply clip.