void GenerateDispFaceObject (int index, int model) { surface f = BuildDispFace (index, model, map.facesLump[index].dispinfo); GameObject faceObject = new GameObject ("DispFace: " + f.index); MeshRenderer mr = faceObject.AddComponent<MeshRenderer> (); mr.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.TwoSided; //Making model shadows two-sided for better quality. //Material mat; MeshFilter mf = faceObject.AddComponent<MeshFilter> (); mf.sharedMesh = new Mesh (); mf.sharedMesh.name = "DispFace " + f.index; mf.sharedMesh.vertices = f.points; mf.sharedMesh.triangles = f.triangles; mf.sharedMesh.uv = f.uv; mf.sharedMesh.colors32 = f.cols; if (uSrcSettings.Inst.textures) { bsptexdata curTexData = map.texdataLump[map.texinfosLump[map.facesLump[index].texinfo].texdata]; //===========================Material============================= string materialName = ""; //VMTLoader.VMTFile vmtFile=null; //Material tempmat=null; //string if (map.texdataStringDataLump.Length > map.texdataStringTableLump[curTexData.nameStringTableID] + 92) materialName = new string (map.texdataStringDataLump, map.texdataStringTableLump[curTexData.nameStringTableID], 92); else materialName = new string (map.texdataStringDataLump, map.texdataStringTableLump[curTexData.nameStringTableID], map.texdataStringDataLump.Length - map.texdataStringTableLump[curTexData.nameStringTableID]); materialName = materialName.ToLower (); if (materialName.Contains ("\0")) materialName = materialName.Remove (materialName.IndexOf ('\0')); Material tempmat = ResourceManager.Inst.GetMaterial (materialName); //=================Material End======================== mr.material = tempmat; } else { mr.material = Test.Inst.testMaterial; } mf.sharedMesh.RecalculateNormals (); faceObject.transform.parent = dispObject.transform; var o_835_3_636690536766835854 = mf.sharedMesh; faceObject.isStatic = true; if (uSrcSettings.Inst.genColliders) { faceObject.AddComponent<MeshCollider> (); } }
// 指定した面に属する4つの頂点を配列で返す public static vertices[] GetVerticesArrayOf(surface surf) { var data = vertexData[(int)surf]; vertices[] array = { data.vert1, data.vert2, data.vert3, data.vert4 }; return(array); }
Texture2D CreateLightmapTex(surface f) { int rowColors = f.lightMapW; Texture2D tex = new Texture2D(f.lightMapW, f.lightMapH, TextureFormat.RGB24, false, true); //tex.filterMode = FilterMode.Point; Color32[] colors = new Color32[(f.lightMapW) * (f.lightMapH)]; int Offset = map.facesLump [f.index].lightofs / 4; if (map.facesLump [f.index].lightofs < 0 | map.lightingLump.Length == 0) { return(null); } int o = 0; int j = 0; for (int y = 0; y < f.lightMapH; y++) { o = (rowColors * (y)); for (int x = 0; x < f.lightMapW; x++) { colors[o++] = map.lightingLump[Offset + j++]; } } //=======fill borders================ /* * for(int y=0; y<f.lightMapH+1;y++) * { * o=rowColors * y; * colors[o] = colors[o+1]; * * o=(rowColors * (y+1))-1; * colors[o] = colors[o-1]; * } * * int end=(f.lightMapW+2)*(f.lightMapH+2); * for(int x=0; x<f.lightMapW+2;x++) * { * colors[x] = colors[x+rowColors]; * colors[(end-rowColors)+x] = colors[(end-(rowColors*2)+x)]; * } */ //===================================== tex.SetPixels32(colors); tex.Apply(); return(tex); }
unsafe void learn_the_surface(ref surface current_surface, ref state_model current_model, int flag) { double left_height = 0; double right_height = 0; if (flag == 1) { //reycast right Raycasting(flag, ref left_height, ref right_height); current_surface.start_x = current_model.Coord.x; current_surface.start_y = current_model.Coord.y - left_height; } else { //reycast left Raycasting(flag, ref left_height, ref right_height); current_surface.start_x = current_model.Coord.x - current_surface.limitation_x; current_surface.start_y = current_model.Coord.y - left_height; } current_surface.angle = Math.Atan((left_height - right_height) / current_surface.limitation_x); }
surface BuildDispFace(int faceIndex, int model, short dispinfoId) { Vector3[] vertices = new Vector3[4]; List <Vector3> disp_verts = new List <Vector3>(); List <Vector2> UVs = new List <Vector2>(); List <Color32> cols = new List <Color32>(); List <int> indices = new List <int>(); bspface curFace = map.facesLump[faceIndex]; bsptexinfo curTexInfo = map.texinfosLump[curFace.texinfo]; bsptexdata curTexData = map.texdataLump[curTexInfo.texdata]; int fEdge = curFace.firstedge; for (int i = 0; i < curFace.numedges; i++) { vertices[i] = (map.surfedgesLump[fEdge + i] > 0 ? map.vertexesLump[map.edgesLump[Mathf.Abs(map.surfedgesLump[fEdge + i])][0]] : map.vertexesLump[map.edgesLump[Mathf.Abs(map.surfedgesLump[fEdge + i])][1]]); } bspdispinfo curDisp = map.dispinfoLump [dispinfoId]; Vector3 startPos = curDisp.startPosition; float dist; float minDist = 0.1f; int minIndex = 0; for (int i = 0; i < 4; i++) { dist = Vector3.Distance(startPos, vertices[i]); if (dist < minDist) { minDist = dist; minIndex = i; } } Vector3 temp; for (int i = 0; i < minIndex; i++) { temp = vertices[0]; vertices[0] = vertices[1]; vertices[1] = vertices[2]; vertices[2] = vertices[3]; vertices[3] = temp; } Vector3 leftEdge = vertices[1] - vertices[0]; Vector3 rightEdge = vertices[2] - vertices[3]; int numEdgeVertices = (1 << curDisp.power) + 1; float subdivideScale = 1.0f / (float)(numEdgeVertices - 1); Vector3 leftEdgeStep = leftEdge * subdivideScale; Vector3 rightEdgeStep = rightEdge * subdivideScale; int firstVertex = 0; Vector3 leftEnd; Vector3 rightEnd; Vector3 leftRightSeg; Vector3 leftRightStep; int dispVertIndex; bspDispVert dispVert; Vector3 flatVertex; Vector3 dispVertex; float scaleU = (float)1f / curTexData.width; float scaleV = (float)1f / curTexData.height; for (int i = 0; i < numEdgeVertices; i++) { leftEnd = leftEdgeStep * (float)i; leftEnd += vertices[0]; rightEnd = rightEdgeStep * (float)i; rightEnd += vertices[3]; leftRightSeg = rightEnd - leftEnd; leftRightStep = leftRightSeg * subdivideScale; for (int j = 0; j < numEdgeVertices; j++) { dispVertIndex = curDisp.DispVertStart; dispVertIndex += i * numEdgeVertices + j; dispVert = map.dispVertsLump[dispVertIndex]; flatVertex = leftEnd + (leftRightStep * (float)j); dispVertex = dispVert.vec * (dispVert.dist /* *scale*/); dispVertex += flatVertex; disp_verts.Add(dispVertex); float tU = Vector3.Dot(flatVertex, curTexInfo.texvecs) + (curTexInfo.texoffs); float tV = Vector3.Dot(flatVertex, curTexInfo.texvect) + (curTexInfo.texofft); UVs.Add(new Vector2(tU * scaleU, tV * scaleV)); cols.Add(new Color32((byte)(dispVert.alpha), 0, 0, 0)); } } int curIndex; for (int i = 0; i < numEdgeVertices - 1; i++) { for (int j = 0; j < numEdgeVertices - 1; j++) { curIndex = i * numEdgeVertices + j; if ((curIndex % 2) == 1) { curIndex += firstVertex; indices.Add(curIndex + 1); indices.Add(curIndex); indices.Add(curIndex + numEdgeVertices); indices.Add(curIndex + numEdgeVertices + 1); indices.Add(curIndex + 1); indices.Add(curIndex + numEdgeVertices); } else { curIndex += firstVertex; indices.Add(curIndex); indices.Add(curIndex + numEdgeVertices); indices.Add(curIndex + numEdgeVertices + 1); indices.Add(curIndex + 1); indices.Add(curIndex); indices.Add(curIndex + numEdgeVertices + 1); } } } for (int i = 0; i < disp_verts.Count; i++) { disp_verts[i] *= uSrcSettings.Inst.worldScale; } surface f = new surface(); f.index = faceIndex; //f.flags = flags; f.dispinfo = dispinfoId; f.points = disp_verts.ToArray(); f.uv = UVs.ToArray(); //f.uv2 = UV2s; f.cols = cols.ToArray(); f.triangles = indices.ToArray(); //f.lightMapW = lightmapW; //f.lightMapH = lightmapH; return(f); }
GameObject GenerateFaceObject(int index) { //List<Vector3> verts=new List<Vector3>(); //List<Vector2> UVs=new List<Vector2>(); //List<Vector2> lightmapUV=new List<Vector2>(); //List<int> tris = new List<int>(); surface f = BuildFace(index); //f.index = index; //if((f.flags & 4) == 4) // return; //tris.AddRange (f.triangles); //verts.AddRange (f.points); //UVs.AddRange (f.uv); //lightmapUV.AddRange(f.uv2); GameObject faceObject = new GameObject("Face: " + index); MeshRenderer mr = faceObject.AddComponent <MeshRenderer>(); //Material mat; MeshFilter mf = faceObject.AddComponent <MeshFilter>(); mf.sharedMesh = new Mesh(); mf.sharedMesh.name = "BSPFace " + index; mf.sharedMesh.vertices = f.points; mf.sharedMesh.triangles = f.triangles; mf.sharedMesh.uv = f.uv; //=======================//????????? /* * Vector4[] tang = new Vector4[verts.Count]; * for (int i=0; i<verts.Count; i++) * tang [i] = new Vector4 (0, 0, 1); * * mf.mesh.tangents = tang; */ //======================== if (uSrcSettings.Inst.textures) { bsptexdata curTexData = map.texdataLump[map.texinfosLump[map.facesLump[index].texinfo].texdata]; //===========================Material============================= string materialName = ""; //VMTLoader.VMTFile vmtFile=null; //Material tempmat=null; //string if (map.texdataStringDataLump.Length > map.texdataStringTableLump [curTexData.nameStringTableID] + 92) { materialName = new string (map.texdataStringDataLump, map.texdataStringTableLump [curTexData.nameStringTableID], 92); } else { materialName = new string (map.texdataStringDataLump, map.texdataStringTableLump [curTexData.nameStringTableID], map.texdataStringDataLump.Length - map.texdataStringTableLump [curTexData.nameStringTableID]); } materialName = materialName.ToLower(); if (materialName.Contains("\0")) { materialName = materialName.Remove(materialName.IndexOf('\0')); } //return VMTLoader.GetMaterial (materialName); Material tempmat = ResourceManager.Inst.GetMaterial(materialName); //=================Material End======================== //if (tempmat.name.Contains ("trigger")||tempmat.name.Contains ("fogvolume")||tempmat.name.Contains ("tools/toolsskybox")) // mr.enabled = false; mr.material = tempmat; if (uSrcSettings.Inst.lightmaps && map.hasLightmaps) // & !vmtFile.translucent) { //Texture2D lightMap = CreateLightmapTex (f); mf.sharedMesh.uv2 = f.uv2; mr.lightmapIndex = 0; } } else { mr.material = Test.Inst.testMaterial; } mf.sharedMesh.RecalculateNormals(); //mf.mesh.RecalculateBounds (); faceObject.transform.parent = modelsObject.transform; mf.sharedMesh.Optimize(); faceObject.isStatic = true; return(faceObject); }
Texture2D CreateLightmapTex(surface f) { return(null); }
public void CreateModelObject(int index) { int numFaces = map.modelsLump[index].numfaces; int firstFace = map.modelsLump[index].firstface; GameObject model = new GameObject("*" + index); Models.Add(model); model.transform.SetParent(modelsObject.transform); model.isStatic = true; if (uSrcSettings.Inst.lightmaps && map.hasLightmaps) { model.layer = 8; } if (numFaces == 0) { return; } bspface face; bsptexdata texdata; int flags; if (uSrcSettings.Inst.textures) { for (int i = firstFace; i < firstFace + numFaces; i++) { face = map.facesLump[i]; texdata = map.texdataLump[map.texinfosLump[face.texinfo].texdata]; if (texdata.faces == null) { if (Test.Inst.skipSky & (map.texinfosLump[face.texinfo].flags & SourceBSPStructs.SURF_SKY) != 0) { continue; } else { texdata.faces = new List <int>(); } } if (face.dispinfo == -1) { texdata.faces.Add(i); texdata.numvertices += face.numedges; } } } Texture2D modelLightmap = null; List <Texture2D> tempLightmaps = null; if (uSrcSettings.Inst.lightmaps && map.hasLightmaps) { tempLightmaps = new List <Texture2D>(); modelLightmap = new Texture2D(64, 64, TextureFormat.RGB24, true, true); } //int numlightfaces = numFaces; if (!uSrcSettings.Inst.textures) { List <Vector3> verts = new List <Vector3>(); List <Vector2> UVs = new List <Vector2>(); List <Vector2> UV2s = new List <Vector2>(); List <int> tris = new List <int>(); int pointOffs = 0; for (int i = firstFace; i < firstFace + numFaces; i++) { surface surf = BuildFace(i); if ((Test.Inst.skipSky & (surf.flags & SourceBSPStructs.SURF_SKY) != 0) | surf.dispinfo != -1) { continue; } pointOffs = verts.Count; verts.AddRange(surf.points); UVs.AddRange(surf.uv); UV2s.AddRange(surf.uv2); for (int j = 0; j < surf.triangles.Length; j++) { tris.Add(surf.triangles [j] + pointOffs); } if (uSrcSettings.Inst.lightmaps && map.hasLightmaps && (surf.flags & SourceBSPStructs.SURF_NOLIGHT) == 0) { tempLightmaps.Add(CreateLightmapTex(surf)); if (tempLightmaps.Last() == null) { Debug.Log("Face " + i + " haven't lightmap. Model " + index + ". Flags " + surf.flags); } } } Rect[] offsets = null; if (uSrcSettings.Inst.lightmaps && map.hasLightmaps) { offsets = modelLightmap.PackTextures(tempLightmaps.ToArray(), 1); for (int i = 0; i < tempLightmaps.Count; i++) { Destroy(tempLightmaps[i]); } tempLightmaps.Clear(); } tempLightmaps = null; if (uSrcSettings.Inst.lightmaps && map.hasLightmaps) { int curVert = 0; int curRect = 0; Debug.Log("Offsets count " + offsets.Length); for (int i = 0; i < numFaces; i++) { face = map.facesLump[i + firstFace]; flags = map.texinfosLump [face.texinfo].flags; if ((Test.Inst.skipSky & ((flags & SourceBSPStructs.SURF_SKY) != 0)) | face.dispinfo != -1) { continue; } int numVerts = map.facesLump[firstFace + i].numedges; if ((flags & SourceBSPStructs.SURF_NOLIGHT) != 0) { curVert += numVerts; continue; } Rect offs = offsets[curRect]; for (int v = curVert; v < curVert + numVerts; v++) { //if(i<maxLMs) //{ Vector2 tempUV = UV2s[v]; UV2s[v] = new Vector2((tempUV.x * offs.width) + offs.x, (tempUV.y * offs.height) + offs.y); //} //else // UV2s[v] = new Vector2(0.9f,0.9f); } curVert += numVerts; curRect++; } lightmapsData.Add(new LightmapData() { lightmapFar = modelLightmap }); } MeshRenderer mr = model.AddComponent <MeshRenderer>(); if (uSrcSettings.Inst.lightmaps && map.hasLightmaps) { mr.lightmapIndex = curLightmap; curLightmap++; if (curLightmap > 255) { curLightmap = 255; } //mr.lightmapIndex=lightmapsData.Count-1;[ } mr.material = Test.Inst.testMaterial; MeshFilter mf = model.AddComponent <MeshFilter>(); mf.mesh = new Mesh(); mf.mesh.name = "BSPModel_" + index; mf.mesh.vertices = verts.ToArray(); mf.mesh.triangles = tris.ToArray(); mf.mesh.uv = UVs.ToArray(); if (uSrcSettings.Inst.lightmaps && map.hasLightmaps) { mf.mesh.uv2 = UV2s.ToArray(); } mf.mesh.RecalculateNormals(); if (uSrcSettings.Inst.genColliders) { model.AddComponent <MeshCollider>(); } } else { List <Mesh> texMeshes = new List <Mesh>(); for (int i = 0; i < map.texdataLump.Length; i++) { texdata = map.texdataLump[i]; if (texdata.faces == null) { //Debug.Log("TexData "+i+" has no faces"); continue; } List <Vector3> verts = new List <Vector3>(); List <Vector2> UVs = new List <Vector2>(); List <Vector2> UV2s = new List <Vector2>(); List <int> tris = new List <int>(); for (int j = 0; j < texdata.faces.Count; j++) { face = map.facesLump[texdata.faces[j]]; surface surf = BuildFace(texdata.faces[j]); //if ((f.flags & 1024) != 0) //numlightfaces--; int pointOffs = verts.Count; for (int t = 0; t < surf.triangles.Length; t++) { tris.Add(surf.triangles [t] + pointOffs); } verts.AddRange(surf.points); UVs.AddRange(surf.uv); if (uSrcSettings.Inst.lightmaps && map.hasLightmaps) { UV2s.AddRange(surf.uv2); } // if (i < firstFace + maxLMs) // tempLightmaps [i - firstFace] = CreateLightmapTex (f); if (uSrcSettings.Inst.lightmaps && map.hasLightmaps) { if (j < maxLMs) { tempLightmaps.Add(CreateLightmapTex(surf)); } } } string materialName = ""; if (map.texdataStringDataLump.Length > map.texdataStringTableLump [texdata.nameStringTableID] + 92) { materialName = new string (map.texdataStringDataLump, map.texdataStringTableLump [texdata.nameStringTableID], 92); } else { materialName = new string (map.texdataStringDataLump, map.texdataStringTableLump [texdata.nameStringTableID], map.texdataStringDataLump.Length - map.texdataStringTableLump [texdata.nameStringTableID]); } materialName = materialName.ToLower(); if (materialName.Contains("\0")) { materialName = materialName.Remove(materialName.IndexOf('\0')); } GameObject texObj; if (texdata.faces == null) { texObj = model; } else { texObj = new GameObject(materialName); texObj.transform.SetParent(model.transform); } texObj.isStatic = true; if (uSrcSettings.Inst.lightmaps && map.hasLightmaps) { texObj.layer = 8; } MeshRenderer mr = texObj.AddComponent <MeshRenderer>(); MeshFilter mf = texObj.AddComponent <MeshFilter>(); Mesh mesh = new Mesh(); mesh.name = materialName; mesh.vertices = verts.ToArray(); mesh.uv = UVs.ToArray(); if (uSrcSettings.Inst.lightmaps && map.hasLightmaps) { mesh.uv2 = UV2s.ToArray(); } mesh.triangles = tris.ToArray(); mesh.RecalculateNormals(); //mf.sharedMesh = mesh; mf.mesh = mesh; texMeshes.Add(mf.sharedMesh); Material tempmat = ResourceManager.Inst.GetMaterial(materialName); mr.material = tempmat; if (uSrcSettings.Inst.lightmaps && map.hasLightmaps) { mr.lightmapIndex = curLightmap; } if ((materialName.Contains("trigger") || materialName.Contains("fogvolume")) && !uSrcSettings.Inst.showTriggers) { texObj.SetActive(false); } if (uSrcSettings.Inst.genColliders) { texObj.AddComponent <MeshCollider>(); } } //if(texMeshes.Count>0) // Debug.Log ("First Mesh is "+texMeshes[0].name); Rect[] offsets = null; if (uSrcSettings.Inst.lightmaps && map.hasLightmaps) { offsets = modelLightmap.PackTextures(tempLightmaps.ToArray(), 1); //Debug.Log ("tempLightmaps count "+tempLightmaps.Count); for (int l = 0; l < tempLightmaps.Count; l++) { Destroy(tempLightmaps[l]); } tempLightmaps.Clear(); int curMesh = 0; int curVert = 0; int numVerts = 0; int curRect = 0; for (int t = 0; t < map.texdataLump.Length; t++) { texdata = map.texdataLump[t]; if (texdata.faces == null) { continue; } Mesh mesh = texMeshes[curMesh]; curMesh++; Vector2[] uv2 = mesh.uv2; //flags=map.texinfosLump [face.texinfo].flags; for (int f = 0; f < texdata.faces.Count; f++) { if (curRect > offsets.Length) { Debug.Log("curent offset(" + curRect + ") > offsets count"); break; } if (curVert > uv2.Length) { Debug.Log("vert index > uv2 count"); break; } face = map.facesLump[texdata.faces[f]]; numVerts = face.numedges; Rect offs = offsets[curRect]; curRect++; for (int v = curVert; v < curVert + numVerts; v++) { Vector2 tempUV = uv2[v]; uv2[v] = new Vector2((tempUV.x * offs.width) + offs.x, (tempUV.y * offs.height) + offs.y); } curVert += numVerts; } curVert = 0; mesh.uv2 = uv2; texdata.faces.Clear(); texdata.faces = null; } lightmapsData.Add(new LightmapData() { lightmapFar = modelLightmap }); curLightmap++; if (curLightmap > 255) { curLightmap = 255; } } else { for (int t = 0; t < map.texdataLump.Length; t++) { texdata = map.texdataLump[t]; if (texdata.faces == null) { continue; } texdata.faces.Clear(); texdata.faces = null; } } texMeshes.Clear(); texMeshes = null; } }
surface BuildFace(int index) { List <Vector3> verts = new List <Vector3>(); List <Vector2> UVs = new List <Vector2>(); List <Vector2> UV2s = new List <Vector2>(); List <int> tris = new List <int>(); bspface curface = map.facesLump[index]; int startEdge = curface.firstedge; int nEdges = curface.numedges; //Debug.Log("texinfo "+curface.texinfo+"/"+map.texinfosLump.Length); int flags = map.texinfosLump [curface.texinfo].flags; for (int i = startEdge; i < startEdge + nEdges; i++) { verts.Add(map.surfedgesLump[i] > 0 ? map.vertexesLump[map.edgesLump[Mathf.Abs(map.surfedgesLump[i])][0]] : map.vertexesLump[map.edgesLump[Mathf.Abs(map.surfedgesLump[i])][1]]); } for (int i = 1; i < verts.Count - 1; i++) { tris.Add(0); tris.Add(i); tris.Add(i + 1); } bsptexinfo texInfo = map.texinfosLump [map.facesLump [index].texinfo]; float scales = map.texdataLump[texInfo.texdata].width * uSrcSettings.Inst.worldScale; float scalet = map.texdataLump[texInfo.texdata].height * uSrcSettings.Inst.worldScale; for (int i = 0; i < verts.Count; i++) { float tU = Vector3.Dot(verts[i] * uSrcSettings.Inst.worldScale, texInfo.texvecs) + (texInfo.texoffs * uSrcSettings.Inst.worldScale); float tV = Vector3.Dot(verts[i] * uSrcSettings.Inst.worldScale, texInfo.texvect) + (texInfo.texofft * uSrcSettings.Inst.worldScale); UVs.Add(new Vector2(tU / scales, tV / scalet)); } int lightmapW = (map.facesLump[index].LightmapTextureSizeInLuxels[0] + 1); int lightmapH = (map.facesLump[index].LightmapTextureSizeInLuxels[1] + 1); for (int i = 0; i < verts.Count; i++) { float U = Vector3.Dot(verts[i], texInfo.lightvecs) + texInfo.lightoffs + 0.5f - map.facesLump[index].LightmapTextureMinsInLuxels[0]; float V = Vector3.Dot(verts[i], texInfo.lightvect) + texInfo.lightofft + 0.5f - map.facesLump[index].LightmapTextureMinsInLuxels[1]; //U=(U*(float)((float)lightmapW/((float)lightmapW+2f)))+(1f/((float)lightmapW+2f)); //V=(V*(float)((float)lightmapH/((float)lightmapH+2f)))+(1f/((float)lightmapH+2f)); UV2s.Add(new Vector2(U / (lightmapW), V / (lightmapH))); } for (int i = 0; i < verts.Count; i++) { verts[i] *= uSrcSettings.Inst.worldScale; } int texID = map.texdataLump [map.texinfosLump [map.facesLump [index].texinfo].texdata].nameStringTableID; surface f = new surface(); f.index = index; f.flags = flags; f.texID = texID; f.dispinfo = curface.dispinfo; f.points = verts.ToArray(); f.uv = UVs.ToArray(); f.uv2 = UV2s.ToArray(); f.triangles = tris.ToArray(); f.lightMapW = lightmapW; f.lightMapH = lightmapH; return(f); }
public decimal calculateQuote() { decimal rushcost = 0; if (DeskQuote.Width * DeskQuote.Depth < 1000) { switch (DeskQuote.RushDays) { case 3: rushcost = 60; break; case 5: rushcost = 40; break; case 7: rushcost = 30; break; default: break; } } else if (DeskQuote.Width * DeskQuote.Depth >= 1000 && DeskQuote.Width * DeskQuote.Depth <= 2000) { switch (DeskQuote.RushDays) { case 3: rushcost = 70; break; case 5: rushcost = 50; break; case 7: rushcost = 35; break; default: break; } } else if (DeskQuote.Width * DeskQuote.Depth > 2000) { switch (DeskQuote.RushDays) { case 3: rushcost = 80; break; case 5: rushcost = 60; break; case 7: rushcost = 45; break; default: break; } } decimal baseprice = 0; if (DeskQuote.Width * DeskQuote.Depth > 1000) { baseprice = 200 + DeskQuote.Width * DeskQuote.Depth; } else { baseprice = 200; } surface materialcost = ((surface)Enum.Parse(typeof(surface), DeskQuote.SurfaceMaterial)); decimal total = (baseprice + DeskQuote.NumDrawers * 50 + (decimal)materialcost + rushcost); return(total); }
public static unsafe extern int solve_step(ref state_model current_model, ref koef_of_model koef_model, ref surface current_surface, ref double step_time, double force);
public static VerticesOfSurface GetVerticesOf(surface surf) { return(vertexData[(int)surf]); }