public void DisplayDefaultScene() { _scene = new warp_Scene(512, 512); warp_Material crystal = new warp_Material(warp_TextureFactory.MARBLE(128, 128, .15f)); _scene.addMaterial("crystal", crystal); warp_Material c = (warp_Material)_scene.materialData ["crystal"]; c.setReflectivity(255); c.setTransparency(100); _scene.environment.setBackground(warp_TextureFactory.CHECKERBOARD(128, 128, 3, 0x000000, 0x999999)); _scene.addLight("light1", new warp_Light(new warp_Vector(0.2f, 0.2f, 1f), 0xFFFFFF, 320, 80)); _scene.addLight("light2", new warp_Light(new warp_Vector(-1f, -1f, 1f), 0xffffff, 100, 40)); warp_Vector[] path = new warp_Vector[15]; path [0] = new warp_Vector(0.0f, 0.2f, 0); path [1] = new warp_Vector(0.13f, 0.25f, 0); path [2] = new warp_Vector(0.33f, 0.3f, 0); path [3] = new warp_Vector(0.43f, 0.6f, 0); path [4] = new warp_Vector(0.48f, 0.9f, 0); path [5] = new warp_Vector(0.5f, 0.9f, 0); path [6] = new warp_Vector(0.45f, 0.6f, 0); path [7] = new warp_Vector(0.35f, 0.3f, 0); path [8] = new warp_Vector(0.25f, 0.2f, 0); path [9] = new warp_Vector(0.1f, 0.15f, 0); path [10] = new warp_Vector(0.1f, 0.0f, 0); path [11] = new warp_Vector(0.1f, -0.5f, 0); path [12] = new warp_Vector(0.35f, -0.55f, 0); path [13] = new warp_Vector(0.4f, -0.6f, 0); path [14] = new warp_Vector(0.0f, -0.6f, 0); _scene.addObject("wineglass", warp_ObjectFactory.ROTATIONOBJECT(path, 32)); _scene.sceneobject("wineglass").setMaterial(_scene.material("crystal")); _scene.sceneobject("wineglass").scale(0.8f, 0.8f, 0.8f); _scene.sceneobject("wineglass").rotate(0.5f, 0f, 0f); _scene.render(); //Refresh(); }
public bool SetTransparency(string name, int t) { if (_scene == null) { return(false); } warp_Material material = (warp_Material)_scene.materialData [name]; if (material == null) { return(false); } material.setTransparency(t); return(true); }
void CreateWater (WarpRenderer renderer, bool threeD) { float waterHeight = (float)m_scene.RegionInfo.RegionSettings.WaterHeight; int maxSize = m_scene.RegionInfo.RegionSizeX; if (m_scene.RegionInfo.RegionSizeY >= maxSize) maxSize = m_scene.RegionInfo.RegionSizeY; warp_Material waterColormaterial; if (!threeD) { // 20160210 -greythane- // it appears that the default plan object is rotated 45 degrees // work-a-round until verified or otherwise in the Warp3D library renderer.AddPlane ("Water", maxSize); renderer.Scene.sceneobject ("Water").setPos (0, waterHeight, 0); /* reference if(m_scene.RegionInfo.RegionSizeX >= m_scene.RegionInfo.RegionSizeY) renderer.AddPlane ("Water", m_scene.RegionInfo.RegionSizeX/2); else renderer.AddPlane ("Water", m_scene.RegionInfo.RegionSizeY/2); renderer.Scene.sceneobject ("Water").setPos ( (m_scene.RegionInfo.RegionSizeX / 2) - 0.5f, waterHeight, (m_scene.RegionInfo.RegionSizeY / 2) - 0.5f); */ waterColormaterial = new warp_Material (ConvertColor (WATER_COLOR)); // waterColormaterial.setTransparency ((byte)((1f - WATER_COLOR.A) * 255f) * 2); waterColormaterial.setTransparency ((byte)((1f - WATER_COLOR.A) * 255f)); } else { renderer.AddPlane ("Water", maxSize / 2); /* for reference if(m_scene.RegionInfo.RegionSizeX >= m_scene.RegionInfo.RegionSizeY) renderer.AddPlane ("Water", m_scene.RegionInfo.RegionSizeX/2); else renderer.AddPlane ("Water", m_scene.RegionInfo.RegionSizeY/2); */ renderer.Scene.sceneobject ("Water").setPos ( (m_scene.RegionInfo.RegionSizeX / 2f) - 0.5f, -0.5f, waterHeight + 5.1f ); waterColormaterial = new warp_Material (ConvertColor (OPAQUE_WATER_COLOR)); waterColormaterial.setTransparency (48); //waterColormaterial.opaque = true; } waterColormaterial.setReflectivity (0); renderer.Scene.addMaterial ("WaterColor", waterColormaterial); renderer.SetObjectMaterial ("Water", "WaterColor"); }
void CreateWater(WarpRenderer renderer, bool threeD) { float waterHeight = (float) m_scene.RegionInfo.RegionSettings.WaterHeight; warp_Material waterColormaterial; if (!threeD) { if(m_scene.RegionInfo.RegionSizeX >= m_scene.RegionInfo.RegionSizeY) renderer.AddPlane ("Water", m_scene.RegionInfo.RegionSizeX/2); else renderer.AddPlane ("Water", m_scene.RegionInfo.RegionSizeY/2); renderer.Scene.sceneobject ("Water").setPos ((m_scene.RegionInfo.RegionSizeX / 2) - 0.5f, waterHeight, (m_scene.RegionInfo.RegionSizeY / 2) - 0.5f); waterColormaterial = new warp_Material (ConvertColor (WATER_COLOR)); waterColormaterial.setTransparency ((byte)((1f - WATER_COLOR.A) * 255f) * 2); } else { if(m_scene.RegionInfo.RegionSizeX >= m_scene.RegionInfo.RegionSizeY) renderer.AddPlane ("Water", m_scene.RegionInfo.RegionSizeX/2); else renderer.AddPlane ("Water", m_scene.RegionInfo.RegionSizeY/2); renderer.Scene.sceneobject ("Water").setPos ( (m_scene.RegionInfo.RegionSizeX / 2) -0.5f, - 0.5f, waterHeight+5.1f ); waterColormaterial = new warp_Material(ConvertColor(OPAQUE_WATER_COLOR)); waterColormaterial.setTransparency (48); //waterColormaterial.opaque = true; } waterColormaterial.setReflectivity(0); renderer.Scene.addMaterial("WaterColor", waterColormaterial); renderer.SetObjectMaterial("Water", "WaterColor"); }