`// Copyright (c) 1994 Knowledge Adventure. All Rights Reserved.
`
`1
`
`#include <math.h>
`
`#include <ka/std.h>
`
`#include "avplane.h"
`
`#include KA_INC(stdmath.h)
`#include KA_INC(frob.h)
`
`//-------------------------------------------------------------------------
`/*static*/ BOOL
`
`
`
`AVPlane::testVisible(
`
`Vista*
`
`vista,
`
`Point3*
`
`vLeft,
`
`Point3*
`
`vRight,
`
`const Point2& size)
`//
`// Is the vplane visible at all? To find out, transform the object corners
`// into viewer coords.
`
`// First a quick check: if the object is facing away nothing to do.
`
`// Facing away if viewer in back halfplane.
`
`if (vista->_viewpoint._at.y >= 0)
`
`return FALSE;
`
`const Viewpoint& vp = vista->_viewpoint;
`
`// Convert the corners to Viewer coordinate space.
`
`if (vista->_viewpoint._dir == Angle::_pi2)
`{
`
`
`
`
`vLeft->x = -vp._at.x;
`vLeft->y = -vp._at.z;
`vLeft->z = -vp._at.y;
`
`vRight->x = size._x - vp._at.x;
`
`vRight->y = size._y - vp._at.z;
`
`vRight->z = -vp._at.y;
`
`} else
`{
`
`
`
`int sinA = vp._dir.sin();
`int cosA = vp._dir.cos();
`
`
`
`
`
`
`
`
`
`
`
`vLeft->x = StdMath_mulAdd(-vp._at.x, sinA, vp._at.y, cosA,
`
`
`
`
`
`
`
`
`
`
`Angle_COS0/2, Angle_LOGCOS0);
`vLeft->y = - vp._at.z;
`vLeft->z = StdMath_mulAdd(-vp._at.x, cosA, -vp._at.y, sinA,
`
`
`
`
`
`
`
`
`
`
`Angle_COS0/2, Angle_LOGCOS0);
`
`int x = size._x - vp._at.x;
`vRight->x = StdMath_mulAdd(x, sinA, vp._at.y, cosA, Angle_COS0/2,
`
`
`
`
`
`
`
`
`
`
`
`
`
`Angle_LOGCOS0);
`
`{
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`123456789
`
`10
`11
`12
`13
`14
`15
`16
`17
`18
`19
`20
`21
`22
`23
`24
`25
`26
`27
`28
`29
`30
`31
`32
`33
`34
`35
`36
`37
`38
`39
`40
`41
`42
`43
`44
`45
`46
`47
`48
`49
`50
`51
`52
`
`IPR2015-01264, -01268, -01269, -01319, -01321, -01325
`EX. 2034
`Page 1 of 10
`
`
`
`2
`
`BOOL leftOut = abs(vLeft->x) >= (vLeft->z << sShift);
`BOOL rightOut = abs(vRight->x) >= (vRight->z << sShift);
`
`C:\Worlds Source Code Archive\FROBVPLA.CPP
`53
`
`
`vRight->y = size._y - vp._at.z;
`54
`
`
`vRight->z = StdMath_mulAdd(x, cosA, -vp._at.y, sinA, Angle_COS0/2,
`55
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`Angle_LOGCOS0);
`56
`
`}
`57
`
`
`58
`//--------------------------------------------------------
`
`
`59
`// Crude determination of whether anything of the object is visible.
`
`
`60
`// Find clipped approximate endpoints in x to b8 precision.
`
`
`61
`// They are approximate in
`
`
`62
`// that they might be overlarge, but they are guaranteed not to
`
`
`63
`// be too restrictive. That is, for objects whose image projects
`
`
`64
`// beyond the window edges, the xLeft and xRight fall between the
`
`
`65
`// window edge and the actual viewplane-projected object edge.
`
`
`66
`// For objects that fit within the window, the x values are the
`
`
`67
`// exact viewport positions of the endpoints.
`
`
`68
`//
`
`
`69
`// Since we know the plane faces the origin from the initial quick
`
`
`70
`// check, we can do the rest of the check quite simply. We work in
`
`
`71
`// the x dimension only, and test that the left and right edges are
`
`
`72
`// within a field-of-view cone with sides with slope 1/power-of-two:
`
`
`73
`//
`
`
`74
`// Viewport:
`
`
`75
`// \___ l-------r ___/ Wide FieldOfView
`
`
`76
`// \___ | R ___/
`
`
`77
`// \___ | ___/ <- Pretend this is a straight line
`
`
`78
`// L \___|___/
`
`
`79
`// --------------------V-------------------- X-axis
`
`
`80
`// | V is Viewer at origin.
`
`
`81
`//
`
`
`82
`// Imagine that the object runs from a left at L to a right at R
`
`
`83
`// in the diagram above. Then L would give an isLeftOffScreen of
`
`
`84
`// TRUE, since it falls outside the field-of-view cone. R, on the
`
`
`85
`// other hand, falls within the cone so isRightOffScreen would be
`
`
`86
`// FALSE. Any point within the cone is guaranteed not to overflow
`
`
`87
`// the StdMath_div.
`
`
`88
`//
`
`
`89
`// The shift of 0 used here corresponds to a 90-deg FOV cone. We
`
`
`90
`// could use a shift of up to 14 without overflowing the
`
`
`91
`// StdMath_div below (14 + 16 = 30 bits). But we use a smaller
`
`
`92
`// shift in order to weed out invisible walls so as to avoid needing
`
`
`93
`// to do further computation on them.
`
`
`94
`//
`
`
`95
`
`const int sShift = 0; // 90 deg FOV.
`96
`97
`98
`99
`100
`101
`102
`103
`104
`
`int xLeft;
`if (!leftOut)
`
`xLeft = max(vista->_viewport.p1._x, // 16 is for viewportDist<<8
`
`
`
`
`
` StdMath_div(vLeft->x, vLeft->z, 16));
`else
`
`
`
`
`
`
`
`
`
`
`
`IPR2015-01264, -01268, -01269, -01319, -01321, -01325
`EX. 2034
`Page 2 of 10
`
`
`
`// If both out of view, is invisible unless
`
`if (rightOut)
`
`return vLeft->x < 0 // vLeft->x<0 && vRight->x>0, which means
`
` && vRight->x > 0; // that it spans the screen on both sides
`
`
`xLeft = vista->_viewport.p1._x;
`
`3
`
`int xRight;
`if (!rightOut)
`// 16 is for viewportDist<<8
`
`xRight = min(vista->_viewport.p2._x,
`
`
`
`
`
` StdMath_div(vRight->x, vRight->z, 16));
`else
`
`xRight = vista->_viewport.p2._x;
`
`return xLeft < xRight;
`
`
`
`
`
`
`
`
`
`}
`
`//-------------------------------------------------------------------------
`static int
`
`
`
`projectEndpoint(int x, int z)
`//
`// Project clipped ends of object to viewPlane.
`// b8 = b8 * b8 / b8. The 16 shift is viewportDist = 256<<8.
`//
`// Uses maximum s15b8 value on overflow. This isn't correct, so the display
`// will look wrong, but it works well for portals which might be right next
`// to the camera but don't have anything of their own to display anyway so the
`// exact values used here don't matter.
`
`C:\Worlds Source Code Archive\FROBVPLA.CPP
`105
`
`{
`106
`
`
`107
`
`
`108
`
`
`109
`
`
`110
`
`
`111
`
`}
`112
`113
`114
`115
`116
`117
`118
`119
`120
`121
`122
`123
`124
`125
`126
`127
`128
`129
`130
`131
`132
`133
`134
`135
`136
`137
`138
`139
`140
`141
`142
`143
`144
`145
`146
`147
`148
`149
`150
`151
`152
`153
`154
`155
`156
`
`if (x < 0)
`{
`if (-x >= (z << 8))
`
`
`return -32767 << 8;
`
`} else
`{
`
`
`}
`
`if (x >= (z << 8))
`
`return 32767 << 8;
`
`return StdMath_div(x, z, 16);
`
`{
`
`
`
`
`
`
`
`
`
`
`
`
`}
`
`//-------------------------------------------------------------------------
`static void
`
`
`
`
`doProjectVertical(
`
`const Point3&
`left,
`
`const Point3&
`right,
`
`AVPlane::Trapezoid* trap)
`//
`// Find the xs[12], ys[1234] project screen position values from the 3d
`// left and right values. Applies clipping to do this.
`
`IPR2015-01264, -01268, -01269, -01319, -01321, -01325
`EX. 2034
`Page 3 of 10
`
`
`
`4
`
`C:\Worlds Source Code Archive\FROBVPLA.CPP
`157
`//
`158
`// Here is a drawing of a wall, used below to explain the notation used:
`159
`//
`160
`// O__
`161
`// | 4__
` <-- ys4
`162
`// | \__
`163
`// | .....3__ <-- ys3
`164
`// | . . O <--- right (3-d)
`165
`// | . . __O
`166
`// | .....2 <-- ys2
`167
`// | __/
`168
`// |__1
`
` <-- ys1
`169
`// O
`
`
` <--- left (3-d)
`170
`// ^ ^
`
`
`171
`// xs1 xs2
`172
`//
`173
`// In this diagram, the L,O,R symbols show the actual corners of the object.
`174
`// In practice they might even be behind the viewer, so that there is no way
`175
`// to represent them in a 2-d drawing, but for the purpose of this example
`176
`// they just stick out not too far beyond the viewwindow edges.
`177
`//
`178
`// The rectangle of periods represents the viewwindow. The
`179
`// 1,2,3,4 symbols show the corners of the clipped wall, clipped so that it
`180
`// is bigger than the viewwindow, but small enough so that it can be
`181
`// guaranteed to project onto a finite part of the viewplane. This is an
`182
`// x-dimension-only concept. xs1 and xs2 are the results showing where the
`183
`// clipping points are.
`184
`//
`185
`// xs1 and xs2 are also chosen to clip out parts of the object that are too
`186
`// close to or are behind the viewer. That is, there is a front clipping
`187
`// plane. The position of the front clipping plane varies depending on the
`188
`// height of the image; it is always arranged so that the ys[1234] values fit
`189
`// in s15b8.
`190
`191
`192
`193
`194
`195
`196
`197
`198
`199
`200
`201
`202
`203
`204
`205
`206
`207
`208
`
`// Here's a top view:
`//
`// R
`// __/____ <-- viewplane
`//
` / |
`// / | z
`// L V |_x
`//
`// Find the positions of the left and right endpoints of LR, clipped
`// so their x components fall within an area of the viewplane
`// representable as s15b8. They must be clipped to a position outside
`// the viewwindow to avoid letting the user see the clipping.
`//
`// A field of view with power-of-two sloping sides is used for the clip
`// as in testVisible(). See the discussion there for more details.
`//
`// For the left endpoint, the
`// clip position is the point on LR where x = -z. LR is defined as:
`
`{
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`IPR2015-01264, -01268, -01269, -01319, -01321, -01325
`EX. 2034
`Page 4 of 10
`
`
`
`5
`
`Point3 clipLeft = left;
`Point3 clipRight = right;
`
`const int sShift = 0; // 90 deg FOV.
`
`int v = StdMath_div(left.x + (left.z<<sShift),
`
`
`
`
`(left.x - right.x) + ((left.z - right.z)<<sShift),
`
`
`
`
`30);
`// b30.
`clipLeft.x += StdMath_mul(right.x - left.x, v, 0, 30);
`clipLeft.z += StdMath_mul(right.z - left.z, v, 0, 30);
`
`// b8
`// b8
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`C:\Worlds Source Code Archive\FROBVPLA.CPP
`209
`
`//
`210
`
`// (Lx + (Rx-Lx)*v, Ly + (Ry-Ly)*v, Lz + (Rz-Lz)*v)
`211
`
`//
`212
`
`// Setting x = -s*z gives:
`213
`
`//
`214
`
`// Lx + (Rx-Lx)*v = -s*(Lz + (Rz-Lz)*v)
`215
`
`// Lx+s*Lz = -v * ((Rx-Lx)+s*(Rz-Lz))
`216
`
`// v = (Lx+s*Lz)/((Lx-Rx)+s*(Lz-Rz))
`217
`
`//
`218
`
`// Here, s is 1 for a 90 deg FOV, but can be set higher to
`219
`
`// widen the field of view if needed.
`220
`
`//
`221
`
`// We have first checked to verify that the line intersects the FOV
`222
`
`// edge, so it's guaranteed that v is in [0,1]. This allows the use of
`223
`
`// many bits of precision for v.
`224
`
`//
`225
`
`// If the wall passes so close to the viewer that the calcs below
`226
`
`// would overflow s15b8, the whole wall is clipped. This case is
`227
`
`// triggered only for pathological situations.
`228
`
`//
`229
`
`// The v calc can't divide overflow due to approximation error since the
`230
`
`// computation is exact, and it can't overflow in the theoretical case
`231
`
`// of the line lying on the FOV edge because of the preceding "if".
`232
`233
`234
`235
`236
`237
`238
`239
`240
`241
`242
`243
`244
`245
`246
`247
`248
`249
`250
`251
`252
`253
`254
`255
`256
`257
`258
`259
`260
`
`// The right edge of the FOV is the same but with x=s instead of x=-s,
`// and swapping left and right.
`int v = StdMath_div(right.x - (right.z<<sShift),
`
`
`
`
`(right.x - left.x) - ((right.z - left.z)<<sShift),
`
`
`
`
`30);
`// b30.
`clipRight.x += StdMath_mul(left.x - right.x, v, 0, 30); // b8
`clipRight.z += StdMath_mul(left.z - right.z, v, 0, 30); // b8
`
`if (left.x < (-left.z << sShift))
`{
`
`
`
`
`
`}
`dAssert(clipLeft.z > 0);
`
`if (right.x > (right.z << sShift))
`{
`
`
`
`
`
`
`
`}
`dAssert(clipRight.z > 0);
`
`
`
`// Project the endpoints to the viewport.
`
`IPR2015-01264, -01268, -01269, -01319, -01321, -01325
`EX. 2034
`Page 5 of 10
`
`
`
`6
`
`// LowerLeft corner of object
`// UpperRight corner of object
`
`/-------------------------------------------------------------------------
`/*static*/ void
`
`
`AVPlane::project(
`
`Frob*
`
`
`f,
`
`Point3*
`
`
`vLeft,
`
`Point3*
`
`
`vRight,
`
`AVPlane::Trapezoid* trap,
`
`Vista*
`
`
`vista)
`//
`// Project a vertical rectangular object onto the screen, as seen by the
`// camera at *vista.
`//
`// Set _bounding and _bounded accordingly in f.
`//
`// Messes with vLeft, vRight, and sets *trap. Uses the clipping rect in
`// viewport space.
`
`C:\Worlds Source Code Archive\FROBVPLA.CPP
`261
`
`trap->_xs1 = projectEndpoint(clipLeft.x, clipLeft.z);
`262
`
`trap->_xs2 = projectEndpoint(clipRight.x, clipRight.z);
`263
`
`trap->_ys1 = projectEndpoint(clipLeft.y, clipLeft.z);
`264
`
`trap->_ys2 = projectEndpoint(clipLeft.y, clipRight.z);
`265
`
`trap->_ys3 = projectEndpoint(clipRight.y, clipRight.z);
`266
`
`trap->_ys4 = projectEndpoint(clipRight.y, clipLeft.z);
`267
`268
`269
`270
`271
`272
`273
`274
`275
`276
`277
`278
`279
`280
`281
`282
`283
`284
`285
`286
`287
`288
`289
`290
`291
`292
`293
`294
`295
`296
`297
`298
`299
`300
`301
`302
`303
`304
`305
`306
`307
`308
`309
`310
`311
`312
`
`
`
`
`
`
`
`
`
`
`f->_bounding = Rect2(0);
`f->_bounded = Rect2(0);
`
`if (vista->_clip.isNull())
`
`return;
`
`// If whole thing clipped anyway, skip it.
`
`doProjectVertical(*vLeft, *vRight, trap);
`
`// Translate the projected corners from the viewPlane to
`// the physical screen.
`//
`// We will also scale the object's X coords for later use by the paint
`// module. This just saves us from needing to pass the scale factors
`// around
`//
`// screenCoord = screenOrigin - (0.5,0.5) +
`// ((viewCoord - viewOrigin) * screenSize / viewSize)
`//
`// b8 = b8 + ((b8 - b8) * b8 / b8)
`
`if (trap->_xs1 < trap->_xs2)
`{
`
`
`
`
`
`
`
`int s = (vista->_viewwindow._left << 8) - 0x80;
`int w = vista->_viewport.p1._x;
`int ss = vista->_viewwindow.width() << 8;
`int ww = vista->_viewport.width();
`trap->_xs1 = s + StdMath_mulDiv(trap->_xs1 - w, ss, ww);
`trap->_xs2 = s + StdMath_mulDiv(trap->_xs2 - w, ss, ww);
`
`} /
`
`{
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`IPR2015-01264, -01268, -01269, -01319, -01321, -01325
`EX. 2034
`Page 6 of 10
`
`
`
`7
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`C:\Worlds Source Code Archive\FROBVPLA.CPP
`313
`314
`315
`316
`317
`318
`319
`320
`321
`322
`323
`324
`325
`326
`327
`328
`329
`330
`331
`332
`333
`334
`335
`336
`337
`338
`339
`340
`341
`342
`343
`344
`345
`346
`347
`348
`349
`350
`351
`352
`353
`354
`355
`356
`357
`358
`359
`360
`361
`362
`363
`364
`
`} /
`
`/-------------------------------------------------------------------------
`
`
`
`
`
`
`
`AVPlane::Trapezoid::Trapezoid()
`
`:
`
`_xs1(0), _xs2(0), _ys1(0), _ys2(0), _ys3(0), _ys4(0)
`{}
`
`//-------------------------------------------------------------------------
`
`
`
`
`
`
`
`AVPlane::Trapezoid::Trapezoid(
`
`int xs1, int xs2,
`
`int ys1, int ys2, int ys3, int ys4)
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`}
`
`// What a hack! Preadjusts the x coords for the viewscreenDist
`
`// adjustment mentioned in axyobjec/vpaint.cpp's
`
`// computeDataFactors().
`
`vLeft->x = StdMath_mulDiv(vLeft->x, ss, ww);
`vRight->x = StdMath_mulDiv(vRight->x, ss, ww);
`
`s = (vista->_viewwindow._top << 8) - 0x80;
`w = vista->_viewport.p2._y;
`ss = vista->_viewwindow.height() << 8;
`ww = vista->_viewport.height();
`trap->_ys1 = s + StdMath_mulDiv(w - trap->_ys1, ss, ww);
`trap->_ys2 = s + StdMath_mulDiv(w - trap->_ys2, ss, ww);
`trap->_ys3 = s + StdMath_mulDiv(w - trap->_ys3, ss, ww);
`trap->_ys4 = s + StdMath_mulDiv(w - trap->_ys4, ss, ww);
`
`// Use screen coords to fill in the Frob's _bounding, etc.
`// Becomes inclusive coords for this purpose.
`
`// This equation must match paintv2's exactly so bounding fits
`
`// precisely around the region. The outermost max or min
`
`// effectively does a f->_bounding &= vista->clip. We do it
`
`// inline to force the values into the short range.
`
`f->_bounding._left = short(max((trap->_xs1 >> 8)+1,
`
`
`
`
`
`
`
` int(vista->_clip._left)));
`f->_bounding._right = short(min(trap->_xs2 >> 8,
`
`
`
`
`
`
`
` int(vista->_clip._right)));
`f->_bounding._top = short(max((min(trap->_ys3, trap->_ys4) >> 8)+1,
`
`
`
`
`
`
`
` int(vista->_clip._top)));
`f->_bounding._bottom = short(min(max(trap->_ys1, trap->_ys2) >> 8,
`
`
`
`
`
`
`
`
` int(vista->_clip._bottom)));
`
`f->_bounded._left = f->_bounding._left;
`f->_bounded._right = f->_bounding._right;
`f->_bounded._top = short(max((max(trap->_ys3, trap->_ys4) >>8)+1,
`
`
`
`
`
`
`
`
` int(vista->_clip._top)));
`f->_bounded._bottom = short(min(min(trap->_ys1, trap->_ys2) >> 8,
`
`
`
`
`
`
`
`
` int(vista->_clip._bottom)));
`
`IPR2015-01264, -01268, -01269, -01319, -01321, -01325
`EX. 2034
`Page 7 of 10
`
`
`
`8
`
`//-------------------------------------------------------------------------
`
`
`
`
`
`
`
`struct AVPlaneFrob : APlaneFrob
`
`static Frob* make(AObject* o, Vista* vista, const Point3& size);
`
`MemPoolUser_DECL();
`
`{
`
`
`
`
`
`
`
`
`
`
`
`
`
`protected:
`
`AVPlaneFrob(
`o,
`
`
`
`AObject*
`
`
`const Point3& size,
`
`
`Vista*
`
`vista,
`
`
`const Point3& vLeft,
`
`
`const Point3& vRight);
`};
`
`MemPoolUser_DEF(AVPlaneFrob);
`
`
`
`
`
`
`
`
`// Only make() can call this.
`
`
`
`
`
`
`
`
`
`
`// LowerLeft corner of object
`// UpperRight corner of object
`
`C:\Worlds Source Code Archive\FROBVPLA.CPP
`365
`
`:
`366
`
`_xs1(xs1), _xs2(xs2), _ys1(ys1), _ys2(ys2), _ys3(ys3), _ys4(ys4)
`367
`{}
`368
`369
`370
`371
`372
`373
`374
`375
`376
`377
`378
`379
`380
`381
`382
`383
`384
`385
`386
`387
`388
`389
`390
`391
`392
`393
`394
`395
`396
`397
`398
`399
`400
`401
`402
`403
`404
`405
`406
`407
`408
`409
`410
`411
`412
`413
`414
`415
`416
`
`//-------------------------------------------------------------------------
`
`
`
`
`
`
`
`AVPlaneFrob::AVPlaneFrob(
`
`AObject*
`
`o,
`
`const Point3& size,
`
`Vista*
`
`vista,
`
`const Point3& vLeft,
`
`const Point3& vRight)
`
`:
`
`APlaneFrob(o, size, vista)
`
`
`
`
`
`
`
`
`
`
`// LowerLeft corner of object
`// UpperRight corner of object
`
`AVPlane::Trapezoid trap;
`Point3 tempLeft = vLeft;
`Point3 tempRight = vRight;
`AVPlane::project(this, &tempLeft, &tempRight, &trap, vista);
`
`{
`
`
`
`
`
`} /
`
`/-------------------------------------------------------------------------
`/*static*/ Frob*
`
`
`AVPlaneFrob::make(
`
`AObject*
`
`o,
`
`Vista*
`
`vista,
`
`const Point3& size)
`//
`// If any part of the plane is visible on the screen, make a frob for it.
`
`Point3 vLeft, vRight;
`Frob* f = 0;
`if (AVPlane::testVisible(vista, &vLeft, &vRight, AVPlane::xySize(size)))
`
`{
`
`
`
`
`IPR2015-01264, -01268, -01269, -01319, -01321, -01325
`EX. 2034
`Page 8 of 10
`
`
`
`9
`
`DELETE f;
`f = 0;
`
`C:\Worlds Source Code Archive\FROBVPLA.CPP
`417
`
`{
`418
`
`
`419
`
`
`420
`
`
`421
`
`
`422
`
`
`423
`
`
`424
`
`}
`425
`426
`427
`428
`429
`430
`431
`432
`433
`434
`435
`436
`437
`438
`439
`440
`441
`442
`443
`444
`445
`446
`447
`448
`449
`450
`451
`452
`453
`454
`455
`456
`457
`458
`459
`460
`461
`462
`463
`464
`465
`466
`467
`468
`
`return APlane::subMakeFrob(o, vista, fIn, size, AVPlaneFrob::make);
`
`{
`
`}
`
`
`//-------------------------------------------------------------------------
`Frob*
`
`
`
`
`AVPlane::makeFrob(Vista* vista, Frob* f)
`
`return subMakeFrob(this, vista, f, _pos._size);
`
`{
`
`}
`
`
`//---------------------------------------------------------------------
`void
`
`
`
`
`AVPlane::translateAndDescribe(
`
`Vista*
`vista,
`
`FrobPos*
`frobPos)
`//
`// Adjust the eye position from one coordinate system to an x-aligned one.
`// Returns the new eye. The size info from the passed-in Pos is used for
`// orientation only, the magnitude of the values doesn't matter.
`//
`// Figures the rotation of the vplane about its left corner, as well
`// as the translation of the left corner to the new xy surface location.
`// Then apply these transformations to the eye to shift from the
`// one coordinate space to the other.
`
`Viewpoint saver(vista->_viewpoint);
`
`// Can't have a floor inside a wall.
`
`dAssert(vista->_viewpoint._lookingDown == 0);
`
`// Transform into internal coord system.
`
`Point3& at = vista->_viewpoint._at;
`
`{
`
`
`
`
`
`
`
`
`
`f = NEW AVPlaneFrob(o, size, vista, vLeft, vRight);
`if (f->_bounding.isNull())
`{
`
`
`}
`
`return f;
`
`
`
`} /
`
`/-------------------------------------------------------------------------
`/*static*/ Frob*
`
`
`
`AVPlane::subMakeFrob(
`
`AObject*
`
`o,
`
`Vista*
`
`vista,
`
`Frob*
`
`fIn,
`
`const Point3& size)
`
`IPR2015-01264, -01268, -01269, -01319, -01321, -01325
`EX. 2034
`Page 9 of 10
`
`
`
`10
`
`C:\Worlds Source Code Archive\FROBVPLA.CPP
`469
`
`at -= _pos._start;
`470
`
`Angle rotation = - Angle(_pos._size.xy());
`471
`
`Frob::rotate(&at.x, &at.y, rotation);
`472
`
`vista->_viewpoint._dir += rotation;
`473
`474
`475
`476
`477
`478
`479
`
`vista->_viewpoint = saver;
`
`
`
`}
`
`
`
`AObject::translateAndDescribe(vista, frobPos);
`
`IPR2015-01264, -01268, -01269, -01319, -01321, -01325
`EX. 2034
`Page 10 of 10