private void ShowOneDebugPixelAt(Vector3 p, System.Drawing.Color c) { if (mNumPixelNodesUsed >= mPixelsToShow.numChildren()) { // need to create new ones UWB_Primitive prim = CreateSphereMesh(); prim.EnableLighting(false); UWB_SceneNode pNode = new UWB_SceneNode(); pNode.setPrimitive(prim); UWB_XFormInfo xf = pNode.getXFormInfo(); xf.SetTranslation(p); xf.SetScale(new Vector3(kPixelSize)); pNode.setXFormInfo(xf); prim.Material.Diffuse = Vector4.Zero; prim.Material.Specular = Vector4.Zero; prim.Material.Ambient = Vector4.Zero; prim.Material.Emissive = new Vector4(c.R / 255.0f, c.G / 255.0f, c.B / 255.0f, 1f); mPixelsToShow.insertChildNode(pNode); } else { // there are more to be reused ... UWB_SceneNode n = mPixelsToShow.getChildNode(mNumPixelNodesUsed); UWB_XFormInfo xf = n.getXFormInfo(); xf.SetTranslation(new Vector3(p.X, p.Y, p.Z)); UWB_Primitive prim = n.getPrimitive(); prim.setVisible(true); prim.Material.Diffuse = Vector4.Zero; prim.Material.Specular = Vector4.Zero; prim.Material.Ambient = Vector4.Zero; prim.Material.Emissive = new Vector4(c.R / 255.0f, c.G / 255.0f, c.B / 255.0f, 1f); } }
private void SetMeshMaterial(UWB_Primitive prim, RayTracer_552.RTMaterial mat) { prim.EnableLighting(true); prim.setShadeMode(eShadeMode.smGouraud); prim.Material.Emissive = new Vector4(Vector3.Zero, 1f); prim.Material.Ambient = new Vector4(mat.GetAmbientColor, 1f); prim.Material.Diffuse = new Vector4(mat.GetDiffuseColor, 1f); prim.Material.Specular = new Vector4(mat.GetSpecularColor, 1f); prim.Material.Power = mat.GetN; }