Mundarija:
- 1 -qadam: Dasturlarni yuklab oling
- 2 -qadam: Modelingizni XML -ga eksport qiling
- 3 -qadam: Ob'ektni Java -ga import qiling
Video: Java3D modellarini yaratish uchun blenderdan foydalanish: 3 qadam
2024 Muallif: John Day | [email protected]. Oxirgi o'zgartirilgan: 2024-01-30 13:29
Agar siz Java dasturchisi bo'lsangiz, ehtimol siz bir vaqtning o'zida 3D formatida dasturlashni xohlagan bo'lsangiz kerak. Lekin qanday? Siz Java3D -dan foydalanishingiz va 3D ko'pburchakning har bir nuqtasini asta -sekin kirgizishingiz mumkin (bu menga yomon fikr deb ishondi) yoki Blender -dan (https://blender.org) bepul va ochiq kodli 3D modellashtirish dasturidan foydalanishingiz mumkin. Blend2Java deb nomlangan skript (https://sourceforge.net/projects/blend2java/). Biroq, Blend2Java -dagi hujjatlar deyarli yo'q, shuning uchun men bu erda o'tirib yozyapman.
1 -qadam: Dasturlarni yuklab oling
Sizga Blender (https://blender.org) va Blend2Java (https://sourceforge.net/projects/blend2java/) kerak bo'ladi. OK, keyin ikkalasini ham Blender -da oddiy modelni (yoki oddiy kubni ishlatib) ishga tushirgandan so'ng.
2 -qadam: Modelingizni XML -ga eksport qiling
Agar sizda model mavjud bo'lsa, siz Blender -da ishlatmoqchi bo'lgan tahrirlash rejimini oching va "a" tugmachasini bosib barcha nuqtalarni tanlang. Pastki panelda matn muharririni tanlang. Matn muharririda yangi faylni oching. Siz yuklagan blend2java.py faylini oching. Run. Ok sizning ob'ektingiz endi saqlangan joyda. XMLda bo'lishi kerak (agar sizda xato xabari bo'lsa, sizda ob'ekt uchun faqat 1 ta material bor). Ob'ekt nomini o'zgartiring (g'alati ismga ega bo'ladi).
3 -qadam: Ob'ektni Java -ga import qiling
Shape3D fred = null; harakat qilib ko'ring {XMLDecoder e = yangi XMLDecoder (yangi BufferedInputStream (yangi FileInputStream ("c: /HandShape3D.xml"))))); // bu erda sizning fayl nomingiz fred = (Shape3D) e.readObject (); e.yopish (); } catch (istisno e) {e.printStackTrace (); } ColoringAttributes at = new ColoringAttributes (); Tashqi ko'rinish ap = yangi Tashqi ko'rinish (); Color3f col = yangi Color3f (1.0f, 0.0f, 1.0f); ColoringAttributes ca = new ColoringAttributes (col, ColoringAttributes. NICEST); ap.setColoringAttributes (ca); fred.setAppearance (ap); obj.addChild (fred); uni har qanday 3d kodga kiriting yoki bu yerdan butun kodni ishlating java.io.*; import java.beans. XMLDecoder; import java.applet. Applet; import java.awt.*; import java. awt.event.*; import com.sun.j3d.utils.applet. MainFrame; import com.sun.j3d.utils.universe.*; import javax.media.j3d.*; import javax.vecmath.*;.applet. Applet; import java.awt. BorderLayout; import java.awt. Frame; import com.sun.j3d.utils.applet. MainFrame; import com.sun.j3d.utils.geometry. ColorCube; import com.sun. j3d.utils.universe.*; com.sun.j3d.utils.behaviors.mouse.*; import javax.media.j3d.*; import javax.vecmath.*; import java.awt.event.*; import java.util. Enumeration; umumiy sinf MouseBehaviorApp Applet {public BranchGroup createSceneGraph () {BranchGroup objRoot = new BranchGroup (); TransformGroup objTransform = yangi TransformGroup (); objTransform.setCapability (TransformGroup. ALLOW_TRANSFORM_WRITE); objTransform.setCapability (TransformGroup. ALLOW_TRANSFORM_READ); objRoot.addChild (objTransform); Shape3D fred = null; harakat qilib ko'ring {XMLDecoder e = yangi XMLDecoder (yangi BufferedInputStream (yangi FileInputStream ("c: /HandShape3D.xml"))))); fred = (Shape3D) e.readObject (); e.yopish (); } catch (istisno e) {e.printStackTrace (); } ColoringAttributes at = new ColoringAttributes (); Tashqi ko'rinish ap = yangi Tashqi ko'rinish (); Color3f col = yangi Color3f (1.0f, 0.0f, 1.0f); ColoringAttributes ca = new ColoringAttributes (col, ColoringAttributes. NICEST); ap.setColoringAttributes (ca); fred.setAppearance (ap); objTransform.addChild (fred); MouseRotate myMouseRotate = yangi MouseRotate (); myMouseRotate.setTransformGroup (objTransform); myMouseRotate.setSchedulingBounds (yangi BoundingSphere ()); objRoot.addChild (myMouseRotate); MouseTranslate myMouseTranslate = yangi MouseTranslate (); myMouseTranslate.setTransformGroup (objTransform); myMouseTranslate.setSchedulingBounds (yangi BoundingSphere ()); objRoot.addChild (myMouseTranslate); MouseZoom myMouseZoom = yangi MouseZoom (); myMouseZoom.setTransformGroup (objTransform); myMouseZoom.setSchedulingBounds (yangi BoundingSphere ()); objRoot.addChild (myMouseZoom); objRoot.compile (); objRoot -ni qaytarish; } umumiy MouseBehaviorApp () {setLayout (yangi BorderLayout ()); Canvas3D canvas3D = yangi Canvas3D (SimpleUniverse.getPreferredConfiguration ()); qo'shish ("Center", canvas3D); BranchGroup sahnasi = createSceneGraph (); SimpleUniverse simpleU = yangi SimpleUniverse (canvas3D); oddiyU.getViewingPlatform (). setNominalViewingTransform (); simpleU.addBranchGraph (sahna); } public static void main (String args) {Frame frame = new MainFrame (new MouseBehaviorApp (), 256, 256); }} undan to'liq dastur uchun foydalaning! Siz nima qildingiz? Men Java -ni bir oy oldin o'rganganman lol!
Tavsiya:
Model yaratish uchun fotogrametriyadan foydalanish: 9 qadam
Model yaratish uchun fotogrametriyadan foydalanish: men kimman, men Samuel Konklinman va men E.L.ning ikkinchi kursiman. Meyers o'rta maktabi. Men oxirgi ikki oy davomida fotogrammetriya bilan tajriba o'tkazdim va agar siz ushbu mahsulotni qayta yaratishni tanlasangiz, sizga yordam berishga umid qilaman. Men boshqalarning qanday ishlashini ko'rishga qiziqaman
Tamil tilida multimetrdan qanday foydalanish kerak - Yangi boshlanuvchilar uchun qo'llanma - Yangi boshlanuvchilar uchun multimetr: 8 qadam
Tamil tilida multimetrdan qanday foydalanish kerak | Yangi boshlanuvchilar uchun qo'llanma | Yangi boshlanuvchilar uchun multimetr: Salom do'stlar, men bu qo'llanmada men multimetrni elektronikaning barcha turlarida 7 xil bosqichda qanday ishlatishni tushuntirdim, masalan: 1) nosozliklarni aniqlash uchun uzluksizlik testi 2) doimiy oqimni o'lchash 3) diod va LEDni sinovdan o'tkazish 4) o'lchash. Resi
IPad uchun devorga o'rnatish uyni avtomatlashtirishni boshqarish paneli sifatida, ekranni faollashtirish uchun servo boshqariladigan magnitdan foydalanish: 4 qadam (rasmlar bilan)
IPad uchun devorga o'rnatish uyni avtomatlashtirishni boshqarish paneli sifatida, ekranni faollashtirish uchun servo boshqariladigan magnitdan foydalanadi: So'nggi paytlarda men uyim va atrofimdagi narsalarni avtomatlashtirishga ancha vaqt sarfladim. Men Domoticz -ni uy avtomatlashtirish ilovasi sifatida ishlataman, batafsil ma'lumot uchun www.domoticz.com saytiga qarang. Men Domoticz haqidagi barcha ma'lumotlarni ko'rsatadigan asboblar paneli dasturini qidirishda
Maxsus 3D modellarini Minecraft dunyosiga import qiling: 9 qadam (rasmlar bilan)
Maxsus 3D modellarini Minecraft dunyosiga import qiling: bu 3D modellarni Minecraft dunyosiga import qilish jarayonini tushuntirish uchun to'liq qo'llanma. Men jarayonni uchta asosiy qismga ajrataman: Minecraft -ni sozlash, 3D -modelingizni import/eksport qilish va modelni olib kelish
Raqamli tanlov panelini yaratish uchun mis lentasidan foydalanish: 4 qadam
Raqamli tanlov panelini yaratish uchun mis lentasidan foydalanish: Men bu texnikani qisman baham ko'raman va qisman Instructables -dan qanday foydalanishni o'rganyapman. Texnikani hujjatlashtirishda yoki Instructables -dan foydalanishimda muammolar bo'lsa, izohlarda menga xabar bering - rahmat! Menga uzoq qator kerak edi