Ejemplo n.º 1
0
void updateCursorStyle()
{
	/* Multi-window apps - there's only one mouse cursor -it's a shared resource.
	   But the cursor style is owned by each window/freewrl iglobal instance.
	   How does a window know which global instance to ask for style?
	   Simple: when a window gets mouse events, that means the mouse is in 
	   that window. So get the iglobal that goes with that window, and ask 
	   it for the cursor style.
		So a good place to call this updateCursorStyle is near/after 
		freewrl gets a mouse event, like handle_aqua or handle_mev.
	 */
	int cstyle;
	ppcommon p = (ppcommon)gglobal()->common.prv;

	cstyle = p->cursorStyle;
#ifdef _MSC_VER
	updateCursorStyle0(cstyle); /* in fwWindow32 where cursors are loaded */
#else

	ccurse = ocurse = cstyle;

#if !defined (_ANDROID) 
	/* ANDROID - no cursor style right now */
	setCursor(); /*updateCursorStyle0(cstyle); // in fwWindow32 where cursors are loaded */
#endif //ANDROID
#endif
}
Ejemplo n.º 2
0
/* we assume max 8 lights. The max light is the Headlight, so we go through 0-6 for Lights */
int nextlight() {
	ppRenderFuncs p = (ppRenderFuncs)gglobal()->RenderFuncs.prv;
	int rv = p->nextFreeLight;
	if(p->nextFreeLight == 7) { return -1; }
	p->nextFreeLight ++;
	return rv;
}
Ejemplo n.º 3
0
/* send light info into Shader. if OSX gets glGetUniformBlockIndex calls, we can do this with 1 call */
void sendLightInfo (s_shader_capabilities_t *me) {
	ppRenderFuncs p = (ppRenderFuncs)gglobal()->RenderFuncs.prv;
		/* for debugging: */

			/* int i;
			printf ("sendMAt - sending in lightState ");
			for (i=0; i<8; i++) printf ("%d:%d ",i,p->lightOnOff[i]); printf ("\n");
			*/
		

	/* if one of these are equal to -1, we had an error in the shaders... */
	GLUNIFORM1IV(me->lightState,8,p->lightOnOff);
    
	GLUNIFORM1FV (me->lightConstAtten, 8, p->light_constAtten);
	GLUNIFORM1FV (me->lightLinAtten, 8, p->light_linAtten);
	GLUNIFORM1FV(me->lightQuadAtten, 8, p->light_quadAtten);
	GLUNIFORM1FV(me->lightSpotCut, 8, p->light_spotCut);
	GLUNIFORM1FV(me->lightSpotExp, 8, p->light_spotExp);
   
	GLUNIFORM4FV(me->lightAmbient,8,(float *)p->light_amb);
    
	GLUNIFORM4FV(me->lightDiffuse,8,(float *)p->light_dif);
	GLUNIFORM4FV(me->lightPosition,8,(float *)p->light_pos);
	GLUNIFORM4FV(me->lightSpecular,8,(float *)p->light_spec);
	GLUNIFORM4FV(me->lightSpotDir, 8, (float *)p->light_spotDir);
     
}
Ejemplo n.º 4
0
/* keep track of lighting */
void lightState(GLint light, int status) {
	ppRenderFuncs p = (ppRenderFuncs)gglobal()->RenderFuncs.prv;
    //printf ("start lightState, light %d, status %d\n",light,status);
    
    PRINT_GL_ERROR_IF_ANY("start lightState");
    
    
	if (light<0) return; /* nextlight will return -1 if too many lights */
	if (p->lightOnOff[light] != status) {
		if (status) {
			/* printf ("light %d on\n",light); */
            
#ifndef GL_ES_VERSION_2_0
			FW_GL_ENABLE(GL_LIGHT0+light);
#endif /* GL_ES_VERSION_2_0 */
            
			p->lightStatusDirty = TRUE;
		} else {
			/* printf ("light %d off\n",light);  */
            
#ifndef GL_ES_VERSION_2_0
			FW_GL_DISABLE(GL_LIGHT0+light);
#endif /* GL_ES_VERSION_2_0 */
            
			p->lightStatusDirty = TRUE;
		}
		p->lightOnOff[light]=status;
	}
    PRINT_GL_ERROR_IF_ANY("end lightState");
}
Ejemplo n.º 5
0
/* Call this when modelview and projection modified */
void upd_ray() {
	struct point_XYZ t_r1,t_r2,t_r3;
	GLDOUBLE modelMatrix[16];
	GLDOUBLE projMatrix[16];
	ttglobal tg = gglobal();
	FW_GL_GETDOUBLEV(GL_MODELVIEW_MATRIX, modelMatrix);
	FW_GL_GETDOUBLEV(GL_PROJECTION_MATRIX, projMatrix);
/*

{int i; printf ("\n"); 
printf ("upd_ray, pm %p\n",projMatrix);
for (i=0; i<16; i++) printf ("%4.3lf ",modelMatrix[i]); printf ("\n"); 
for (i=0; i<16; i++) printf ("%4.3lf ",projMatrix[i]); printf ("\n"); 
} 
*/


	FW_GLU_UNPROJECT(r1.x,r1.y,r1.z,modelMatrix,projMatrix,viewport,
		     &t_r1.x,&t_r1.y,&t_r1.z);
	FW_GLU_UNPROJECT(r2.x,r2.y,r2.z,modelMatrix,projMatrix,viewport,
		     &t_r2.x,&t_r2.y,&t_r2.z);
	FW_GLU_UNPROJECT(r3.x,r3.y,r3.z,modelMatrix,projMatrix,viewport,
		     &t_r3.x,&t_r3.y,&t_r3.z);

	VECCOPY(tg->RenderFuncs.t_r1,t_r1);
	VECCOPY(tg->RenderFuncs.t_r2,t_r2);
	VECCOPY(tg->RenderFuncs.t_r3,t_r3);

/*
	printf("Upd_ray: (%f %f %f)->(%f %f %f) == (%f %f %f)->(%f %f %f)\n",
	r1.x,r1.y,r1.z,r2.x,r2.y,r2.z,
	t_r1.x,t_r1.y,t_r1.z,t_r2.x,t_r2.y,t_r2.z);
*/

}
Ejemplo n.º 6
0
void setWindowTitle0()
{
	ppcommon p = (ppcommon)gglobal()->common.prv;

	snprintf(p->window_title, sizeof(p->window_title), "FreeWRL");
	setWindowTitle();
}
Ejemplo n.º 7
0
/* Sub, rather than big macro... */
void rayhit(float rat, float cx,float cy,float cz, float nx,float ny,float nz,
	    float tx,float ty, char *descr)  {
	GLDOUBLE modelMatrix[16];
	GLDOUBLE projMatrix[16];
	ppRenderFuncs p;
	ttglobal tg = gglobal();
	p = (ppRenderFuncs)tg->RenderFuncs.prv;

	/* Real rat-testing */
#ifdef RENDERVERBOSE
	printf("RAY HIT %s! %f (%f %f %f) (%f %f %f)\n\tR: (%f %f %f) (%f %f %f)\n",
	       descr, rat,cx,cy,cz,nx,ny,nz,
	       t_r1.x, t_r1.y, t_r1.z,
	       t_r2.x, t_r2.y, t_r2.z
		);
#endif

	if(rat<0 || (rat>tg->RenderFuncs.hitPointDist && tg->RenderFuncs.hitPointDist >= 0)) {
		return;
	}
	FW_GL_GETDOUBLEV(GL_MODELVIEW_MATRIX, modelMatrix);
	FW_GL_GETDOUBLEV(GL_PROJECTION_MATRIX, projMatrix);
	FW_GLU_PROJECT(cx,cy,cz, modelMatrix, projMatrix, viewport, &tg->RenderFuncs.hp.x, &tg->RenderFuncs.hp.y, &tg->RenderFuncs.hp.z);
	tg->RenderFuncs.hitPointDist = rat;
	p->rayHit=p->rayph;
	p->rayHitHyper=p->rayph;
#ifdef RENDERVERBOSE 
	printf ("Rayhit, hp.x y z: - %f %f %f rat %f hitPointDist %f\n",hp.x,hp.y,hp.z, rat, tg->RenderFuncs.hitPointDist);
#endif
}
Ejemplo n.º 8
0
void setMessageBar()
{
	ppcommon p = (ppcommon)gglobal()->common.prv;

	snprintf(&p->messagebar[0], 10, "%10.0f", p->myFps);
	snprintf(&p->messagebar[15], sizeof(p->myMenuStatus)-15, "%s", p->myMenuStatus);
}
Ejemplo n.º 9
0
static void incrementKeySinkList() {
	ppComponent_KeyDevice p = (ppComponent_KeyDevice)gglobal()->Component_KeyDevice.prv;
	if (p->keySinkCurMax >= p->keySyncMallocLen) {
		p->keySyncMallocLen += 10; /* arbitrary number */
		p->keySink = REALLOC(p->keySink, sizeof (struct X3D_Node *) * p->keySyncMallocLen);
	}
}
Ejemplo n.º 10
0
void setMenuFps(float fps)
{
	ppcommon p = (ppcommon)gglobal()->common.prv;

	p->myFps = fps;
	setMessageBar();
}
Ejemplo n.º 11
0
static int setActiveTexture (int c, GLfloat thisTransparency,  GLint *texUnit, GLint *texMode) 
{
	ttglobal tg = gglobal();

	/* which texture unit are we working on? */
    
	/* tie each fw_TextureX uniform into the correct texture unit */
    
	/* here we assign the texture unit to a specific number. NOTE: in the current code, this will ALWAYS
	 * be [0] = 0, [1] = 1; etc. */
	texUnit[c] = c;

#ifdef TEXVERBOSE
	if (getAppearanceProperties()->currentShaderProperties != NULL) {
		printf ("setActiveTexture %d, boundTextureStack is %d, sending to uniform %d\n",c,
			tg->RenderFuncs.boundTextureStack[c],
			getAppearanceProperties()->currentShaderProperties->TextureUnit[c]);
	} else {
		printf ("setActiveTexture %d, boundTextureStack is %d, sending to uniform [NULL--No Shader]\n",c,
			tg->RenderFuncs.boundTextureStack[c]);
	}
#endif
    
	/* is this a MultiTexture, or just a "normal" single texture?  When we
	 * bind_image, we store a pointer for the texture parameters. It is
	 * NULL, possibly different for MultiTextures */

	if (tg->RenderTextures.textureParameterStack[c].multitex_mode == INT_ID_UNDEFINED) {
        
		#ifdef TEXVERBOSE
		printf ("setActiveTexture - simple texture NOT a MultiTexture \n"); 
		#endif

		/* should we set the coloUr to 1,1,1,1 so that the material does not show
		 * through a RGB texture?? */
		/* only do for the first texture if MultiTexturing */
		if (c == 0) {
			#ifdef TEXVERBOSE
			printf ("setActiveTexture - firsttexture  \n"); 
			#endif
			texMode[c]= GL_MODULATE;
		} else {
			texMode[c]=GL_ADD;
		}

	} else {
	/* printf ("muititex source for %d is %d\n",c,tg->RenderTextures.textureParameterStack[c].multitex_source); */
		if (tg->RenderTextures.textureParameterStack[c].multitex_source != MTMODE_OFF) {
		} else {
			glDisable(GL_TEXTURE_2D); /* DISABLE_TEXTURES */
			return FALSE;
		}
	}


	PRINT_GL_ERROR_IF_ANY("");

	return TRUE;
}
Ejemplo n.º 12
0
//	ppCScripts p = (ppCScripts)gglobal()->CScripts.prv;
static int nextScriptHandle (void) {
	int retval; 
	ppCScripts p = (ppCScripts)gglobal()->CScripts.prv;

	retval = p->handleCnt; 
	p->handleCnt++; 
	return retval;
}
Ejemplo n.º 13
0
void addNodeToKeySensorList(struct X3D_Node* node) {
	if ((node->_nodeType == NODE_KeySensor) || (node->_nodeType == NODE_StringSensor)) {
		ppComponent_KeyDevice p = (ppComponent_KeyDevice)gglobal()->Component_KeyDevice.prv;
		incrementKeySinkList();
		p->keySink[p->keySinkCurMax] = node;
		p->keySinkCurMax ++;
	}
}
Ejemplo n.º 14
0
void render_MovieTexture (struct X3D_MovieTexture *node) {
#ifdef HAVE_TO_REIMPLEMENT_MOVIETEXTURES
	/* really simple, the texture number is calculated, then simply sent here.
	   The boundTextureStack field is sent, and, made current */

	/*  if this is attached to a Sound node, tell it...*/
	sound_from_audioclip = FALSE;

	loadTextureNode(X3D_NODE(node),NULL);
	gglobal()->RenderFuncs.boundTextureStack[gglobal()->RenderFuncs.textureStackTop] = node->__ctex;
	/* not multitexture, should have saved to boundTextureStack[0] */
#else /* HAVE_TO_REIMPLEMENT_MOVIETEXTURES */
	loadTextureNode(X3D_NODE(node),NULL);
#endif
	
	gglobal()->RenderFuncs.textureStackTop=1;
}
Ejemplo n.º 15
0
void restoreLightState(int *ls) {
	int i;
	ppRenderFuncs p = (ppRenderFuncs)gglobal()->RenderFuncs.prv;
	for (i=0; i<7; i++) {
		if (ls[i] != p->lightOnOff[i]) {
			lightState(i,ls[i]);
		}
	}
}
Ejemplo n.º 16
0
static bool setupShader() {
    ppRenderFuncs p = (ppRenderFuncs)gglobal()->RenderFuncs.prv;
    s_shader_capabilities_t *mysp = getAppearanceProperties()->currentShaderProperties;
    
	if (mysp != NULL) {
        

		/* if we had a shader compile problem, do not draw */
		if (!(mysp->compiledOK)) {
#ifdef RENDERVERBOSE
			printf ("shader compile error\n");
#endif
			return false;
		}
        
#ifdef RENDERVERBOSE
        printf ("we have Normals %d Vertices %d Colours %d TexCoords %d \n",
                mysp->Normals,
                mysp->Vertices,
                mysp->Colours,
                mysp->TexCoords);
		if (p->shaderNormalArray) printf ("p->shaderNormalArray TRUE\n"); else printf ("p->shaderNormalArray FALSE\n");        
        if (p->shaderVertexArray) printf ("shaderVertexArray TRUE\n"); else printf ("shaderVertexArray FALSE\n");
        if (p->shaderColourArray) printf ("shaderColourArray TRUE\n"); else printf ("shaderColourArray FALSE\n");
		if (p->shaderTextureArray) printf ("shaderTextureArray TRUE\n"); else printf ("shaderTextureArray FALSE\n");               
#endif
        
        /* send along lighting, material, other visible properties */
        sendMaterialsToShader(mysp);
        sendMatriciesToShader(mysp);
        
		if (mysp->Normals != -1) {
			if (p->shaderNormalArray) glEnableVertexAttribArray(mysp->Normals);
			else glDisableVertexAttribArray(mysp->Normals);
		}
        
		if (mysp->Vertices != -1) {
			if (p->shaderVertexArray) glEnableVertexAttribArray(mysp->Vertices);
			else glDisableVertexAttribArray(mysp->Vertices);
		}
        
		if (mysp->Colours != -1) {
			if (p->shaderColourArray) glEnableVertexAttribArray(mysp->Colours);
			else glDisableVertexAttribArray(mysp->Colours);
		}
        
		if (mysp->TexCoords != -1) {
			if (p->shaderTextureArray) glEnableVertexAttribArray(mysp->TexCoords);
			else glDisableVertexAttribArray(mysp->TexCoords);
		}
        
	}
    return true;
    
}
Ejemplo n.º 17
0
void killKeySensorNodeList() {
	ppComponent_KeyDevice p = (ppComponent_KeyDevice)gglobal()->Component_KeyDevice.prv;
	FREE_IF_NZ(p->keySink);
	p->keySyncMallocLen = 0; 
	p->keySinkCurMax = 0;

	#ifndef AQUA
	shiftPressed = 0;
	ctrlPressed = 0;
	#endif
}
Ejemplo n.º 18
0
/* prints to a log file if we are running as a plugin */
static void pluginprint (const char *m, const char *p)
{
	double myt;
	if (gglobal()->internalc.global_plugin_print) {
        	/* Set the timestamp */
		myt = Time1970sec();
        	printf ("%f: freewrl: ",myt);
		printf(m,p);
	}

}
Ejemplo n.º 19
0
/* used to test new hits */



//struct X3D_Group *_rootNode=NULL;	/* scene graph root node */
struct X3D_Group *rootNode()
{
	// ConsoleMessage ("rootNode called");
	ppRenderFuncs p = (ppRenderFuncs)gglobal()->RenderFuncs.prv;	
if (p==NULL) {
	ConsoleMessage ("rootNode, p null");
	return NULL;
}


	return p->rootNode;
}
Ejemplo n.º 20
0
/* finished rendering thisshape. */
void turnGlobalShaderOff(void) {
	ppRenderFuncs p = (ppRenderFuncs)gglobal()->RenderFuncs.prv;

    /* get rid of the shader */
    getAppearanceProperties()->currentShaderProperties = NULL;
    USE_SHADER(0);

	/* set array booleans back to defaults */
	p->shaderNormalArray = TRUE;
	p->shaderVertexArray = TRUE;
	p->shaderColourArray = FALSE;
	p->shaderTextureArray = FALSE;
}
Ejemplo n.º 21
0
void fwl_initializeDisplayThread()
{
	int ret;
	ttglobal tg = gglobal();
	/* Synchronize trace/error log... */
	fflush(stdout);
	fflush(stderr);
	sync();
	ASSERT(TEST_NULL_THREAD(gglobal()->threads.DispThrd));


	/* Initialize all mutex/condition variables ... */
	pthread_mutex_init( &tg->threads.mutex_resource_tree, NULL );
	pthread_mutex_init( &tg->threads.mutex_resource_list, NULL );
	pthread_mutex_init( &tg->threads.mutex_texture_list, NULL );
	pthread_cond_init( &tg->threads.resource_list_condition, NULL );
	pthread_cond_init( &tg->threads.texture_list_condition, NULL );


	ret = pthread_create(&tg->threads.DispThrd, NULL, (void *) _displayThread, NULL);
	switch (ret) {
	case 0: 
		break;
	case EAGAIN: 
		ERROR_MSG("initializeDisplayThread: not enough system resources to create a process for the new thread.");
		return;
	}


#if !defined(TARGET_AQUA) && !defined(_MSC_VER) 
	if (gglobal()->internalc.global_trace_threads) {
		TRACE_MSG("initializeDisplayThread: waiting for display to become initialized...\n");
		while (IS_DISPLAY_INITIALIZED == FALSE) {
			usleep(50);
		}
	}
#endif
}
Ejemplo n.º 22
0
/* loop about waiting for the Browser to send us some stuff. */
int waitForData(int sock) {

	int retval;
	int count;
	int totalcount;
	ppPluginSocket p = (ppPluginSocket)gglobal()->PluginSocket.prv;

	#ifdef PLUGINSOCKETVERBOSE
	pluginprint ("waitForData, socket %d\n",sock);
	#endif

	retval = FALSE;
	count = 0;
	totalcount = 80000;

	do {
		/*
		#ifdef PLUGINSOCKETVERBOSE
		pluginprint ("waitForData on socket looping...%d\n",count);
		#endif
		*/

		p->tv.tv_sec = 0;
		p->tv.tv_usec = 100;
		FD_ZERO(&p->rfds);
		FD_SET(sock, &p->rfds);

		/* wait for the socket. We HAVE to select on "sock+1" - RTFM */
		retval = select(sock+1, &p->rfds, NULL, NULL, &p->tv);


		if (retval) {
			#ifdef PLUGINSOCKETVERBOSE
			pluginprint ("waitForData returns TRUE\n","");
			#endif

			return (TRUE);
		} else {
			count ++;
			if (count > totalcount) {
				#ifdef PLUGINSOCKETVERBOSE
				pluginprint ("waitForData, timing out\n","");
				#endif

				return (FALSE);
			}
		}
	} while (!retval);
	return 0 ;
}
Ejemplo n.º 23
0
/* lets disable textures here */
void textureDraw_end(void) {
	ttglobal tg = gglobal();
    
#ifdef TEXVERBOSE
	printf ("start of textureDraw_end\n");
#endif

	/* DISABLE_TEXTURES */
	/* setting this ENSURES that items, like the HUD, that are not within the normal
	   rendering path do not try and use textures... */
	tg->RenderFuncs.textureStackTop = 0;

        FW_GL_MATRIX_MODE(GL_MODELVIEW);
}
Ejemplo n.º 24
0
/* initialize a script from a url. Expects valid input */
BOOL script_initCodeFromMFUri(struct Shader_Script* me, const struct Multi_String* s) {
	size_t i;
	ppCScripts p = (ppCScripts)gglobal()->CScripts.prv;

	for(i=0; i!=s->n; ++i) {
		FREE_IF_NZ(p->buffer);
		if(script_initCodeFromUri(me, s->p[i]->strptr)) {
			FREE_IF_NZ(p->buffer);
   			return TRUE;
		}
	}

	/* failure... */
	FREE_IF_NZ(p->buffer);
 	return FALSE;
}
Ejemplo n.º 25
0
void child_Appearance (struct X3D_Appearance *node) {
	struct X3D_Node *tmpN;
	
	/* initialization */
	gglobal()->RenderFuncs.last_texture_type = NOTEXTURE;
	
	/* printf ("in Appearance, this %d, nodeType %d\n",node, node->_nodeType);
	   printf (" vp %d geom %d light %d sens %d blend %d prox %d col %d\n",
	   render_vp,render_geom,render_light,render_sensitive,render_blend,render_proximity,render_collision); */
	
	/* Render the material node... */
	RENDER_MATERIAL_SUBNODES(node->material);
	    
	if (node->fillProperties) {
		POSSIBLE_PROTO_EXPANSION(struct X3D_Node *, node->fillProperties,tmpN);
		render_node(tmpN);
	}
Ejemplo n.º 26
0
void setMenuStatus(char *stattext)
{
	int loading = FALSE;
	ppcommon p = (ppcommon)gglobal()->common.prv;

        if (fwl_isinputThreadParsing() || 
	    fwl_isTextureParsing() || 
	    (!fwl_isInputThreadInitialized())) loading = TRUE;

	if (loading) {
		snprintf(p->myMenuStatus, sizeof(p->myMenuStatus),
			 "(Loading...)");
	} else {
		snprintf(p->myMenuStatus, sizeof(p->myMenuStatus),
			 "Viewpoint: %s", stattext);
	}
}
Ejemplo n.º 27
0
void CALLBACK FW_IFS_tess_vertex(void *p) {
	int *dp;
	ttglobal tg = gglobal();
	dp =(int*)p;

	if (tg->Tess.global_IFS_Coord_count == TESS_MAX_COORDS) {
		/* printf ("FW_IFS_tess_vertex, too many coordinates in this face, change TESS_MAX_COORDS\n"); */
		/*
		global_IFS_Coord_count++;
		global_IFS_Coords[global_IFS_Coord_count] =
			global_IFS_Coords[global_IFS_Coord_count-1];
		*/
	} else {
		/*printf ("FW_IFS_tess_vertex, global_ifs_coord count %d, pointer %d\n",global_IFS_Coord_count,*dp);*/
		tg->Tess.global_IFS_Coords[tg->Tess.global_IFS_Coord_count++] = *dp;
	}

}
Ejemplo n.º 28
0
void fwl_initializeTextureThread()
{
	int ret;
	ttglobal tg = gglobal();

	/* Synchronize trace/error log... */
	fflush(stdout);
	fflush(stderr);

	ASSERT(TEST_NULL_THREAD(tg->threads.loadThread));
	ret = pthread_create(&tg->threads.loadThread, NULL, (void *(*)(void *))&_textureThread, NULL);
	switch (ret) {
	case 0: 
		break;
	case EAGAIN: 
		ERROR_MSG("initializeTextureThread: not enough system resources to create a process for the new thread.");
		return;
	}
}
Ejemplo n.º 29
0
void initializeLightTables() {
	int i;
        float pos[] = { 0.0f, 0.0f, 1.0f, 0.0f };
        float dif[] = { 1.0f, 1.0f, 1.0f, 1.0f };
        float shin[] = { 0.6f, 0.6f, 0.6f, 1.0f };
        float As[] = { 0.0f, 0.0f, 0.0f, 1.0f };
	ppRenderFuncs p = (ppRenderFuncs)gglobal()->RenderFuncs.prv;

      PRINT_GL_ERROR_IF_ANY("start of initializeightTables");

	for(i=0; i<8; i++) {
                p->lightOnOff[i] = 9999;
                lightState(i,FALSE);
            
        	FW_GL_LIGHTFV(i, GL_POSITION, pos);
        	FW_GL_LIGHTFV(i, GL_AMBIENT, As);
        	FW_GL_LIGHTFV(i, GL_DIFFUSE, dif);
        	FW_GL_LIGHTFV(i, GL_SPECULAR, shin);
          	FW_GL_LIGHTF(i, GL_CONSTANT_ATTENUATION,1.0f);
        	FW_GL_LIGHTF(i, GL_LINEAR_ATTENUATION,0.0f);
        	FW_GL_LIGHTF(i, GL_QUADRATIC_ATTENUATION,0.0f);
        	FW_GL_LIGHTF(i, GL_SPOT_CUTOFF,180.0f);
        	FW_GL_LIGHTF(i, GL_SPOT_EXPONENT,0.0f);
            
            PRINT_GL_ERROR_IF_ANY("initizlizeLight2");
        }
        lightState(HEADLIGHT_LIGHT, TRUE);

	#ifndef GL_ES_VERSION_2_0
        FW_GL_LIGHTMODELI(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR);
        FW_GL_LIGHTMODELI(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
        FW_GL_LIGHTMODELI(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_FALSE);
        FW_GL_LIGHTMODELI(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
        FW_GL_LIGHTMODELFV(GL_LIGHT_MODEL_AMBIENT,As);
	#else
	//printf ("skipping light setups\n");
	#endif

    LIGHTING_INITIALIZE
	

    PRINT_GL_ERROR_IF_ANY("end initializeLightTables");
}
Ejemplo n.º 30
0
int KeySensorNodePresent() {
	int count;
	ppComponent_KeyDevice p = (ppComponent_KeyDevice)gglobal()->Component_KeyDevice.prv;

	/* no KeyDevice node present */
	if (p->keySink == NULL) return FALSE;

	for (count=0; count < p->keySinkCurMax; count++) {
		/* hmmm, there is one, but is it enabled? */
		/* printf ("ks, checking %d\n",p->keySink[count]); */

		if (p->keySink[count]->_nodeType == NODE_KeySensor) 
			if (X3D_KEYSENSOR(p->keySink[count])->enabled) return TRUE;

		if (p->keySink[count]->_nodeType == NODE_StringSensor) 
			if (X3D_STRINGSENSOR(p->keySink[count])->enabled) return TRUE;
	}

	return FALSE;
}