Beispiel #1
0
void FogNode::outputContext(ostream &printStream, const char *indentString) 
{
	SFColor *color = getColorField();
	SFString *fogType = getFogTypeField();

	printStream << indentString << "\t" << "color " << color << endl;
	printStream << indentString << "\t" << "fogType " << fogType << endl;
	printStream << indentString << "\t" << "visibilityRange " << getVisibilityRange() << endl;
}
Beispiel #2
0
void PointLightNode::outputContext(ostream &printStream, const char *indentString) 
{
	SFColor *color = getColorField();
	SFVec3f *attenuation = getAttenuationField();
	SFVec3f *location = getLocationField();
	SFBool *bon = getOnField();

	printStream << indentString << "\t" << "on " << bon  << endl;
	printStream << indentString << "\t" << "intensity " << getIntensity()  << endl;
	printStream << indentString << "\t" << "ambientIntensity " << getAmbientIntensity()  << endl;
	printStream << indentString << "\t" << "color " << color  << endl;
	printStream << indentString << "\t" << "location " << location  << endl;
	printStream << indentString << "\t" << "radius " << getRadius()  << endl;
	printStream << indentString << "\t" << "attenuation " << attenuation  << endl;
}
Beispiel #3
0
static void processObject( Obj *obj, Scene *scene, mmap& materials )
{
	// Assume the object is named.
	string name;
	Obj *child; 

	if( obj->getTypeName() == "id" ) {
		name = obj->getID();
		child = NULL;
	} else if( obj->getTypeName() == "named" ) {
		name = obj->getName();
		child = obj->getChild();
	} else {
		ostrstream oss;
		oss << "Unknown input object ";
		obj->printOn( oss );

		throw ParseError( string( oss.str() ) );
	}

	if( name == "directional_light" ) {
		if( child == NULL ) {
			throw ParseError( "No info for directional_light" );
		}

		scene->add( new DirectionalLight( scene, 
			tupleToVec( getField( child, "direction" ) ).normalize(),
			tupleToVec( getColorField( child ) ) ) );
	} else if( name == "point_light" ) {
		if( child == NULL ) {
			throw ParseError( "No info for point_light" );
		}
		PointLight* pointLight = new PointLight(scene,
			tupleToVec(getField(child, "position")),
			tupleToVec(getColorField(child)));
		scene->add(pointLight);

		if (hasField(child, "constant_attenuation_coeff") && 
			hasField(child, "linear_attenuation_coeff")	&& 
			hasField(child, "quadratic_attenuation_coeff"))
		{
			pointLight->setAttenuationCoefficients(
				getField(child, "constant_attenuation_coeff")->getScalar(),
				getField(child, "linear_attenuation_coeff")->getScalar(),
				getField(child, "quadratic_attenuation_coeff")->getScalar());
		}
	}
	else if (name == "ambient_light") {
		if (child == NULL) {
			throw ParseError("No info for ambient_light");
		}
		AmbientLight* ambientLight = new AmbientLight(scene,
			tupleToVec(getColorField(child)));
		scene->add(ambientLight);
	} else if( 	name == "sphere" ||
				name == "box" ||
				name == "cylinder" ||
				name == "cone" ||
				name == "square" ||
				name == "translate" ||
				name == "rotate" ||
				name == "scale" ||
				name == "transform" ||
                name == "trimesh" ||
                name == "polymesh") { // polymesh is for backwards compatibility.
		processGeometry( name, child, scene, materials, &scene->transformRoot);
		//scene->add( geo );
	} else if( name == "material" ) {
		processMaterial( child, &materials );
	} else if( name == "camera" ) {
		processCamera( child, scene );
	} else {
		throw ParseError( string( "Unrecognized object: " ) + name );
	}
}
Beispiel #4
0
void FogNode::getColor(float value[]) 
{
	getColorField()->getValue(value);
}
Beispiel #5
0
void FogNode::setColor(float r, float g, float b) 
{
	getColorField()->setValue(r, g, b);
}
Beispiel #6
0
COLORREF CppSQLite3Query::getColorField(const CString& szField, COLORREF crNullValue /*= 0*/)
{
	int nField = fieldIndex(szField);
	return getColorField(nField, crNullValue);
}
Beispiel #7
0
void LightNode::setColor(float value[])
{
	getColorField()->setValue(value);
}