45 glRotatef(mi->
angles[0], 0, 0, 1);
46 glRotatef(mi->
angles[1], 0, 1, 0);
47 glRotatef(mi->
angles[2], 1, 0, 0);
73 glDrawArrays(GL_TRIANGLES, 0, mesh->
num_tris * 3);
92 glDrawArrays(GL_TRIANGLES, 0, mesh->
num_tris * 3);
115 glDrawArrays(GL_TRIANGLES, 0, mesh->
num_tris * 3);
145 glMatrix[0] = orient->
axis[0][0];
146 glMatrix[4] = orient->
axis[1][0];
147 glMatrix[8] = orient->
axis[2][0];
148 glMatrix[12] = orient->
origin[0];
150 glMatrix[1] = orient->
axis[0][1];
151 glMatrix[5] = orient->
axis[1][1];
152 glMatrix[9] = orient->
axis[2][1];
153 glMatrix[13] = orient->
origin[1];
155 glMatrix[2] = orient->
axis[0][2];
156 glMatrix[6] = orient->
axis[1][2];
157 glMatrix[10] = orient->
axis[2][2];
158 glMatrix[14] = orient->
origin[2];
166#define R_GetTagOrientByFrame(mod, tagIndex, frame) &(((mod)->alias.tags)[tagIndex].orient[frame])
174 Com_Printf(
"Could not get tags for tag %s of model %s\n", tagName, mod->
name);
195 Com_Printf(
"Could not get tag matrix for tag %s of model %s\n", tagName, mod->
name);
215 if (backLerp == 0.0) {
219 if (backLerp == 1.0) {
225 const float frontLerp = 1.0 - backLerp;
228 for (
int i = 0;
i < 3;
i++) {
230 tag.
axis[0][
i] = old->
axis[0][
i] * backLerp + current->
axis[0][
i] * frontLerp;
231 tag.
axis[1][
i] = old->
axis[1][
i] * backLerp + current->
axis[1][
i] * frontLerp;
232 tag.
axis[2][
i] = old->
axis[2][
i] * backLerp + current->
axis[2][
i] * frontLerp;
282 const float factorX = boxSize[0] / width;
283 const float factorY = boxSize[1] / height;
284 const float size = std::min(factorX, factorY);
328 if (skin ==
nullptr) {
351 if (current !=
nullptr && old !=
nullptr) {
352 float interpolated[16];
358 glMultMatrixf(interpolated);
368 glEnable(GL_DEPTH_TEST);
385 glDisable(GL_DEPTH_TEST);
407 if (skin ==
nullptr) {
449 uint32_t aggregatemask;
466 for (
i = 0;
i < 3;
i++) {
471 mins[
i] = e->
model->modBox.mins[
i];
472 maxs[
i] = e->
model->modBox.maxs[
i];
477 angles[
YAW] = -angles[
YAW];
478 AngleVectors(angles, vectors[0], vectors[1], vectors[2]);
481 for (
i = 0;
i < 8;
i++) {
484 tmp[0] = (
i & 1) ? mins[0] : maxs[0];
485 tmp[1] = (
i & 2) ? mins[1] : maxs[1];
486 tmp[2] = (
i & 4) ? mins[2] : maxs[2];
498 for (
i = 0;
i < 8;
i++) {
502 for (
int j = 0; j <
size; j++) {
507 if (
f - bspPlane->
dist < 0)
511 aggregatemask &= mask;
541 }
else if (
length > 500) {
551 const uint32_t color[] = {0xFF0000FF, 0xFF00FF00, 0xFFFF0000};
552 glEnable(GL_LINE_SMOOTH);
558 for (
int j = 0; j < 3; j++) {
563 GLbyte colorArray[8];
565 memcpy(&colorArray[0], &color[j], 4);
566 memcpy(&colorArray[4], &color[j], 4);
568 R_BindArray(GL_COLOR_ARRAY, GL_UNSIGNED_BYTE, colorArray);
570 glDrawArrays(GL_LINE_STRIP, 0, 2);
582 glDisable(GL_LINE_SMOOTH);
626 if (
refdef.trace.leafnum) {
654 glTranslatef(0, 0, -height + 1.0);
656 glScalef(1.0, 1.0, 0.0);
667 const bool oldBlend =
r_state.blend_enabled;
668 const bool lighting =
r_state.lighting_enabled;
701 glDrawArrays(GL_TRIANGLES, 0, mesh->
num_tris * 3);
719 if (!e->
model->loaded)
726 vec4_t color = {0.8, 0.8, 0.8, 1.0};
734 const float f = 1.0 + sin((
refdef.time + (e->
model->alias.meshes[0].num_tris)) * 6.0) * 0.33;
740 for (
i = 0;
i < 3;
i++) {
782 if (
r_state.specularmap_enabled)
785 if (
r_state.roughnessmap_enabled)
ptl_t * CL_ParticleSpawn(const char *name, int levelFlags, const vec3_t s, const vec3_t v, const vec3_t a)
Spawn a new particle to the map.
void R_Color(const vec4_t rgba)
Change the color to given value.
void getCenter(vec3_t center) const
Calculates the center of the bounding box.
void Com_Printf(const char *const fmt,...)
vec_t VectorLength(const vec3_t v)
Calculate the length of a vector.
void VectorMA(const vec3_t veca, const float scale, const vec3_t vecb, vec3_t outVector)
Sets vector_out (vc) to vevtor1 (va) + scale * vector2 (vb).
void AngleVectors(const vec3_t angles, vec3_t forward, vec3_t right, vec3_t up)
Create the rotation matrix in order to rotate something.
void VectorNormalizeFast(vec3_t v)
fast vector normalize routine that does not check to make sure that length != 0, nor does it return l...
void R_ResetArrayState(void)
void R_DrawBoundingBox(const AABB &absBox)
Draws the model bounding box.
void R_TransformForEntity(const entity_t *e, const vec3_t in, vec3_t out)
QGL_EXTERN GLuint GLsizei GLsizei * length
image_t * r_envmaptextures[MAX_ENVMAPTEXTURES]
void R_EnableModelLights(const light_t **lights, int numLights, bool inShadow, bool enable)
Enable or disable realtime dynamic lighting for models.
void R_UpdateLightList(entity_t *ent)
Recalculate active lights list for the given entity; R_CalcTransform(ent) should be called before thi...
void R_Trace(const Line &trLine, float size, int contentmask)
Moves the given mins/maxs volume through the world from start to end.
local graphics definitions
cvar_t * r_stencilshadows
cvar_t * r_dynamic_lights
static mAliasMesh_t * R_GetLevelOfDetailForModel(const vec3_t origin, const mAliasModel_t *mod)
Searches an appropriate level-of-detail mesh for the given model.
static const float MESH_SHADOW_ALPHA
static void R_DrawAliasStaticWithReset(const mAliasMesh_t *mesh, const vec4_t shellColor)
void R_DrawModelParticle(modelInfo_t *mi)
Renders a particle model for the battlescape.
static void R_RotateForMeshShadow(const entity_t *e)
Applies translation, rotation and scale for the shadow of the specified entity. In order to reuse the...
bool R_GetTagMatrix(const model_t *mod, const char *tagName, int frame, float matrix[16])
static mAliasMesh_t * R_DrawAliasModelBuffer(entity_t *e)
#define R_GetTagOrientByFrame(mod, tagIndex, frame)
static bool R_UpdateShadowOrigin(entity_t *e)
static void R_ComputeGLMatrixFromTag(float *glMatrix, const mAliasTagOrientation_t *orient)
void R_InterpolateTransform(float backLerp, int numframes, const mAliasTagOrientation_t *current, const mAliasTagOrientation_t *old, float *interpolated)
Interpolate the transform for a model places on a tag of another model.
static void R_DrawAliasStatic(const mAliasMesh_t *mesh, const vec4_t shellColor)
Static model render function.
void R_DrawModelDirect(modelInfo_t *mi, modelInfo_t *pmi, const char *tagname)
Draws a model in 2d mode (for rendering model data from the ui).
static void R_DrawAliasTags(const mAliasModel_t *mod)
static void R_DrawAliasFrameLerp(mAliasModel_t *mod, mAliasMesh_t *mesh, float backlerp, int framenum, int oldframenum, const vec4_t shellColor)
Animated model render function.
static void R_DrawMeshModelShell(const mAliasMesh_t *mesh, const vec4_t color)
Draws an animated, colored shell for the specified entity. Rather than re-lerping or re-scaling the e...
bool R_CullMeshModel(const entity_t *e)
Checks whether a model is visible in the current scene.
static void R_ResetArraysAfterStaticMeshRender(void)
static void R_TransformModelDirect(modelInfo_t *mi)
void R_GetTags(const model_t *mod, const char *tagName, int currentFrame, int oldFrame, const mAliasTagOrientation_t **current, const mAliasTagOrientation_t **old)
static const float MESH_SHADOW_MAX_DISTANCE
void R_DrawAliasModel(entity_t *e)
Draw a model from the battlescape entity list.
static void R_DrawMeshShadow(entity_t *e, const mAliasMesh_t *mesh)
Re-draws the mesh using the stencil test. Meshes with stale lighting information, or with a lighting ...
int R_GetTagIndexByName(const model_t *mod, const char *tagName)
Searches the tag data for the given name.
void R_ModelAutoScale(const vec2_t boxSize, modelInfo_t *mi, vec3_t scale, vec3_t center)
Compute scale and center for a model info data structure.
model_t * R_FindModel(const char *name)
Tries to load a model.
image_t * R_AliasModelState(const model_t *mod, int *mesh, int *frame, int *oldFrame, int *skin)
void R_FillArrayData(mAliasModel_t *mod, mAliasMesh_t *mesh, float backlerp, int framenum, int oldframenum, bool prerender)
Converts the model data into the opengl arrays.
void R_EnableTexture(gltexunit_t *texunit, bool enable)
void R_BindDefaultArray(GLenum target)
Binds the appropriate shared vertex array to the specified target.
void R_EnableGlowMap(const image_t *image)
bool R_EnableLighting(r_program_t *program, bool enable)
Enables hardware-accelerated lighting with the specified program. This should be called after any tex...
void R_EnableBumpmap(const image_t *normalmap)
Enables bumpmapping and binds the given normalmap.
void R_EnableBlend(bool enable)
void R_EnableSpecularMap(const image_t *image, bool enable)
void R_EnableRoughnessMap(const image_t *image, bool enable)
void R_EnableShell(bool enable)
void R_EnableColorArray(bool enable)
void R_BindArray(GLenum target, GLenum type, const void *array)
void R_EnableAnimation(const mAliasMesh_t *mesh, float backlerp, bool enable)
Enables animation using keyframe interpolation on the GPU.
void R_EnableStencilTest(bool enable)
#define R_BindTexture(tn)
bool Q_strnull(const char *string)
struct image_s * specularmap
struct image_s * roughnessmap
struct image_s * normalmap
const light_t * lights[MAX_ENTITY_LIGHTS]
char name[MODEL_MAX_PATH]
mAliasTagOrientation_t * orient
static const vec3_t scale
#define Vector4Set(v, r, g, b, a)
#define VectorNegate(src, dest)
#define VectorNotEmpty(a)
#define VectorSubtract(a, b, dest)
#define VectorCopy(src, dest)
#define VectorAdd(a, b, dest)
#define DotProduct(x, y)
Returns the distance between two 3-dimensional vectors.
#define VectorSet(v, x, y, z)
#define VectorScale(in, scale, out)