Cube  Diff

Differences From Artifact [a7072e43d2]:

To Artifact [4e49ca5579]:


76
77
78
79
80
81
82
83

84
85
86
87
88
89
90
91
92

93
94
95
96
97
98
99
76
77
78
79
80
81
82

83
84
85
86
87
88
89
90
91

92
93
94
95
96
97
98
99







-
+








-
+







	glEnable(GL_BLEND);
	glEnable(GL_TEXTURE_2D);
	glDepthMask(GL_TRUE);
};

const int MAXSPHERES = 50;
struct sphere {
	vec o;
	OFVector3D o;
	float size, max;
	int type;
	sphere *next;
};
sphere spheres[MAXSPHERES], *slist = NULL, *sempty = NULL;
bool sinit = false;

void
newsphere(vec &o, float max, int type)
newsphere(OFVector3D &o, float max, int type)
{
	if (!sinit) {
		loopi(MAXSPHERES)
		{
			spheres[i].next = sempty;
			sempty = &spheres[i];
		};
180
181
182
183
184
185
186
187

188
189

190
191
192
193
194
195
196
180
181
182
183
184
185
186

187
188

189
190
191
192
193
194
195
196







-
+

-
+







	if (!editmode)
		return;
	loopv(ents)
	{
		entity &e = ents[i];
		if (e.type == NOTUSED)
			continue;
		vec v = {(float)e.x, (float)e.y, (float)e.z};
		OFVector3D v = OFMakeVector3D(e.x, e.y, e.z);
		particle_splash(2, 2, 40, v);
	};
	}
	int e = closestent();
	if (e >= 0) {
		entity &c = ents[e];
		@autoreleasepool {
			sprintf_s(closeent)(
			    "closest entity = %s (%d, %d, %d, %d), "
			    "selection = (%d, %d)",
222
223
224
225
226
227
228
229

230
231
232
233
234
235
236
222
223
224
225
226
227
228

229
230
231
232
233
234
235
236







-
+







	}
}
COMMAND(loadsky, ARG_1STR)

float cursordepth = 0.9f;
GLint viewport[4];
GLdouble mm[16], pm[16];
vec worldpos;
OFVector3D worldpos;

void
readmatrices()
{
	glGetIntegerv(GL_VIEWPORT, viewport);
	glGetDoublev(GL_MODELVIEW_MATRIX, mm);
	glGetDoublev(GL_PROJECTION_MATRIX, pm);
258
259
260
261
262
263
264
265
266


267
268
269
270
271
272
273
258
259
260
261
262
263
264


265
266
267
268
269
270
271
272
273







-
-
+
+







	    w / 2, h / 2, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &cursordepth);
	double worldx = 0, worldy = 0, worldz = 0;
	gluUnProject(w / 2, h / 2, depthcorrect(cursordepth), mm, pm, viewport,
	    &worldx, &worldz, &worldy);
	worldpos.x = (float)worldx;
	worldpos.y = (float)worldy;
	worldpos.z = (float)worldz;
	vec r = {(float)mm[0], (float)mm[4], (float)mm[8]};
	vec u = {(float)mm[1], (float)mm[5], (float)mm[9]};
	OFVector3D r = OFMakeVector3D(mm[0], mm[4], mm[8]);
	OFVector3D u = OFMakeVector3D(mm[1], mm[5], mm[9]);
	setorient(r, u);
};

void
drawicon(float tx, float ty, int x, int y)
{
	glBindTexture(GL_TEXTURE_2D, 5);